feat: Add Cognito user pool name parameter and update API handlers to include CORS headers

This commit is contained in:
2024-11-23 11:12:46 +02:00
parent 59c0c97252
commit 5f9ee29c8d
14 changed files with 103 additions and 47 deletions

View File

@@ -80,9 +80,9 @@ export const api = createApi({
baseUrl: process.env.NEXT_PUBLIC_API_BASE_URL,
prepareHeaders: async (headers) => {
const session = await fetchAuthSession();
const { accessToken } = session.tokens ?? {};
if (accessToken) {
headers.set("Authorization", `Bearer ${accessToken}`);
const { idToken } = session.tokens ?? {};
if (idToken) {
headers.set("Authorization", `Bearer ${idToken}`);
}
return headers;
},
@@ -120,7 +120,7 @@ export const api = createApi({
}),
invalidatesTags: ["Projects"],
}),
getTasks: build.query<Task[], { projectId: number }>({
getTasks: build.query<Task[], { projectId: string }>({
query: ({ projectId }) => `tasks?projectId=${projectId}`,
providesTags: (result) =>
result