mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-28 09:52:36 +08:00
fix: don't send authentication if user is not authenticated (@fehmer (#5747)
This commit is contained in:
parent
45d27b5e00
commit
0d7e3cf916
1 changed files with 4 additions and 5 deletions
|
|
@ -22,11 +22,10 @@ function buildApi(timeout: number): (args: ApiFetcherArgs) => Promise<{
|
|||
"X-Client-Version": envConfig.clientVersion,
|
||||
};
|
||||
|
||||
const token = isAuthenticated()
|
||||
? await getIdToken(getAuthenticatedUser())
|
||||
: "";
|
||||
|
||||
headers["Authorization"] = `Bearer ${token}`;
|
||||
if (isAuthenticated()) {
|
||||
const token = await getIdToken(getAuthenticatedUser());
|
||||
headers["Authorization"] = `Bearer ${token}`;
|
||||
}
|
||||
|
||||
const fetchOptions: RequestInit = {
|
||||
method: request.method as Method,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue