Skip to content

Commit 4a14ae4

Browse files
fix(account-settings): prevent unauthorized error on ape keys after logout (@hussain-alsayedali) (monkeytypegame#6746)
### Description The getData function will check if the user is authenticated before being called, as the issue seems with updateUI function begin called some times when the user logs out monkeytype\frontend\src\ts\pages\account-settings.ts Tried to replicate the issue but it only happens once every while, don't know why it don't happen everytime. Issue : monkeytypegame#6742
1 parent fc438ec commit 4a14ae4

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

frontend/src/ts/elements/account-settings/ape-key-table.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Ape from "../../ape";
44
import { ApeKey, ApeKeys } from "@monkeytype/schemas/ape-keys";
55
import { format } from "date-fns/format";
66
import { SimpleModal, TextArea } from "../../utils/simple-modal";
7-
7+
import { isAuthenticated } from "../../firebase";
88
const editApeKey = new SimpleModal({
99
id: "editApeKey",
1010
title: "Edit Ape key",
@@ -160,6 +160,8 @@ let apeKeys: ApeKeys | null = {};
160160
const element = $("#pageAccountSettings .tab[data-tab='apeKeys']");
161161

162162
async function getData(): Promise<boolean> {
163+
if (!isAuthenticated()) return false;
164+
163165
showLoaderRow();
164166
const response = await Ape.apeKeys.get();
165167

0 commit comments

Comments
 (0)