Skip to content

Commit 9dd3dec

Browse files
committed
remove env-build
1 parent 59dc50c commit 9dd3dec

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

frontend/src/utils/amplify-utils.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,21 @@ import { createServerRunner } from '@aws-amplify/adapter-nextjs';
77
import { fetchAuthSession } from 'aws-amplify/auth/server';
88
import { FetchAuthSessionOptions, JWT } from 'aws-amplify/auth';
99
import { jwtDecode } from 'jwt-decode';
10+
import { Schema } from '../../../amplify/data/resource';
11+
import { generateServerClientUsingCookies } from '@aws-amplify/adapter-nextjs/data';
1012

1113
const config = require('@/amplify_outputs.json');
1214

15+
export const getAmplifyBackendClient = () =>
16+
generateServerClientUsingCookies<Schema>({
17+
config,
18+
cookies,
19+
authMode: 'iam',
20+
});
21+
22+
export const getSessionClient = () =>
23+
getAmplifyBackendClient().models.SessionStorage;
24+
1325
export const { runWithAmplifyServerContext } = createServerRunner({
1426
config,
1527
});

0 commit comments

Comments
 (0)