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