Skip to content

Commit 3d73b9c

Browse files
committed
不要なcatchを削除
1 parent e6587b1 commit 3d73b9c

File tree

1 file changed

+14
-19
lines changed

1 file changed

+14
-19
lines changed

web/firebase/auth/lib.ts

Lines changed: 14 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -33,25 +33,20 @@ export async function credFetch(
3333
path: string,
3434
body?: unknown,
3535
): Promise<Response> {
36-
try {
37-
let idToken = await getIdToken();
38-
const init: RequestInit = { method };
39-
if (body) {
40-
init.body = JSON.stringify(body);
41-
init.headers = {
42-
"Content-Type": "application/json",
43-
};
44-
}
45-
let res = await fetch(`${path}?token=${idToken}`, init);
46-
47-
if (res.status === 401) {
48-
idToken = await getIdToken();
49-
res = await fetch(`${path}?token=${idToken}`, init);
50-
}
36+
let idToken = await getIdToken();
37+
const init: RequestInit = { method };
38+
if (body) {
39+
init.body = JSON.stringify(body);
40+
init.headers = {
41+
"Content-Type": "application/json",
42+
};
43+
}
44+
let res = await fetch(`${path}?token=${idToken}`, init);
5145

52-
return res;
53-
} catch (error) {
54-
console.error("Error in credFetch function:", error);
55-
throw error;
46+
if (res.status === 401) {
47+
idToken = await getIdToken();
48+
res = await fetch(`${path}?token=${idToken}`, init);
5649
}
50+
51+
return res;
5752
}

0 commit comments

Comments
 (0)