This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

refactor: api client

+22 -37
+2 -2
src/webapp/features/cards/lib/dal.ts
··· 1 - import { createApiClient } from '@/services/apiClient'; 1 + import { createSembleClient } from '@/services/apiClient'; 2 2 import { cache } from 'react'; 3 3 4 4 export const getUrlMetadata = cache(async (url: string) => { 5 - const client = await createApiClient(); 5 + const client = createSembleClient(); 6 6 const response = await client.getUrlMetadata(url); 7 7 8 8 return response;
+2 -2
src/webapp/features/collections/lib/dal.ts
··· 1 - import { createApiClient } from '@/services/apiClient'; 1 + import { createSembleClient } from '@/services/apiClient'; 2 2 import { cache } from 'react'; 3 3 4 4 interface PageParams { ··· 8 8 9 9 export const getCollectionsForUrl = cache( 10 10 async (url: string, params?: PageParams) => { 11 - const client = await createApiClient(); 11 + const client = createSembleClient(); 12 12 const response = await client.getCollectionsForUrl({ 13 13 url, 14 14 page: params?.page,
+2 -2
src/webapp/features/collections/lib/queries/useCollection.tsx
··· 1 - import { createApiClient } from '@/api-client/ApiClient'; 1 + import { createSembleClient } from '@/services/apiClient'; 2 2 import { useSuspenseInfiniteQuery } from '@tanstack/react-query'; 3 3 4 4 interface Props { ··· 8 8 } 9 9 10 10 export default function useCollection(props: Props) { 11 - const apiClient = createApiClient(); 11 + const apiClient = createSembleClient(); 12 12 13 13 const limit = props.limit ?? 20; 14 14
+2 -2
src/webapp/features/notes/lib/dal.ts
··· 1 - import { createApiClient } from '@/services/apiClient'; 1 + import { createSembleClient } from '@/services/apiClient'; 2 2 import { cache } from 'react'; 3 3 4 4 interface PageParams { ··· 8 8 9 9 export const getNoteCardsForUrl = cache( 10 10 async (url: string, params?: PageParams) => { 11 - const client = await createApiClient(); 11 + const client = createSembleClient(); 12 12 const response = await client.getNoteCardsForUrl({ 13 13 url, 14 14 page: params?.page,
+2 -2
src/webapp/features/profile/lib/dal.ts
··· 1 - import { createApiClient } from '@/services/apiClient'; 1 + import { createSembleClient } from '@/services/apiClient'; 2 2 import { cache } from 'react'; 3 3 4 4 export const getProfile = cache(async (didOrHandle: string) => { 5 - const client = await createApiClient(); 5 + const client = createSembleClient(); 6 6 const response = await client.getProfile({ 7 7 identifier: didOrHandle, 8 8 });
+1 -2
src/webapp/features/semble/containers/sembleLibrariesContainer/SembleLibrariesContainer.tsx
··· 62 62 lg: 3, 63 63 }} 64 64 > 65 - <>{u.userId}</> 66 - {/*<CollectionCard key={col.id} collection={col} />*/} 65 + {/*<CollectionCard key={u.userId} collection={u} />*/} 67 66 </Grid.Col> 68 67 ))} 69 68 </Grid>
+1 -1
src/webapp/features/semble/containers/sembleNotesContainer/SembleNotesContainer.tsx
··· 63 63 > 64 64 <NoteCard 65 65 id={note.id} 66 - authorId={note.authorId} 66 + authorId={note.author.id} 67 67 createdAt={note.createdAt} 68 68 note={note.note} 69 69 />
+2 -2
src/webapp/features/semble/lib/dal.ts
··· 1 - import { createApiClient } from '@/services/apiClient'; 1 + import { createSembleClient } from '@/services/apiClient'; 2 2 import { cache } from 'react'; 3 3 4 4 interface PageParams { ··· 8 8 9 9 export const getLibrariesForUrl = cache( 10 10 async (url: string, params?: PageParams) => { 11 - const client = await createApiClient(); 11 + const client = createSembleClient(); 12 12 const response = await client.getLibrariesForUrl({ 13 13 url, 14 14 page: params?.page,
+8 -22
src/webapp/services/apiClient.ts
··· 1 - import { ApiClient } from '@/api-client/ApiClient'; 2 - import { 3 - createClientTokenManager, 4 - createServerTokenManager, 5 - } from '@/services/auth'; 1 + import { createApiClient, createServerApiClient } from '@/api-client/ApiClient'; 6 2 7 - export const createServerSideApiClient = async () => { 8 - const tokenManager = await createServerTokenManager(); 9 - 10 - return new ApiClient( 11 - process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:3000', 12 - tokenManager, 13 - ); 3 + export const createServerSideSembleClient = () => { 4 + return createServerApiClient(); 14 5 }; 15 6 16 - export const createClientSideApiClient = () => { 17 - const tokenManager = createClientTokenManager(); 18 - 19 - return new ApiClient( 20 - process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:3000', 21 - tokenManager, 22 - ); 7 + export const createClientSideSembleClient = () => { 8 + return createApiClient(); 23 9 }; 24 10 25 - export const createApiClient = async () => { 11 + export const createSembleClient = () => { 26 12 if (typeof window === 'undefined') { 27 - return await createServerSideApiClient(); 13 + return createServerSideSembleClient(); 28 14 } else { 29 - return createClientSideApiClient(); 15 + return createClientSideSembleClient(); 30 16 } 31 17 };