Skip to content

Commit

Permalink
remove credentials
Browse files Browse the repository at this point in the history
  • Loading branch information
Kosei805 committed Oct 29, 2024
1 parent 14ca0ef commit dcf3470
Showing 1 changed file with 11 additions and 14 deletions.
25 changes: 11 additions & 14 deletions frontend/client/mutator.ts
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
export const customFetch = async <T>(
url: string,
options?: RequestInit
url: string,
options?: RequestInit,
): Promise<T> => {
const res = await fetch(url, {
...options,
// 異なるオリジンからのCookieを保存する
// 異なるオリジンへCookieを送信する
credentials: "include",
});
const res = await fetch(url, {
...options,
});

const response: { status: number; data?: unknown } = { status: res.status };
const contentType = res.headers.get("content-type");
const response: { status: number; data?: unknown } = { status: res.status };
const contentType = res.headers.get('content-type');

if (contentType?.includes("application/json")) {
response.data = await res.json();
}
if (contentType?.includes('application/json')) {
response.data = await res.json();
}

return response;
return response;
};

0 comments on commit dcf3470

Please sign in to comment.