aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorChristian Fehmer <[email protected]>2023-11-30 14:22:12 +0100
committerGitHub <[email protected]>2023-11-30 13:22:12 +0000
commitbd2d360fc2354f44fc3159322ffe5a92d56c8dc8 (patch)
tree117c4fc0abdebe106fa225b007dcb8060071d25e
parent6c3cfe0ff43b22294393cbf5e28af0e70f21310d (diff)
downloadmonkeytype-bd2d360fc2354f44fc3159322ffe5a92d56c8dc8.tar.gz
monkeytype-bd2d360fc2354f44fc3159322ffe5a92d56c8dc8.zip
impr: remove unnecessary rest call to users/tags (fehmer) (#4826)
-rw-r--r--frontend/src/ts/ape/endpoints/users.ts4
-rw-r--r--frontend/src/ts/db.ts14
2 files changed, 3 insertions, 15 deletions
diff --git a/frontend/src/ts/ape/endpoints/users.ts b/frontend/src/ts/ape/endpoints/users.ts
index 2548c4f45..1fc1f0556 100644
--- a/frontend/src/ts/ape/endpoints/users.ts
+++ b/frontend/src/ts/ape/endpoints/users.ts
@@ -95,10 +95,6 @@ export default class Users {
);
}
- async getTags(): Ape.EndpointResponse {
- return await this.httpClient.get(`${BASE_PATH}/tags`);
- }
-
async createTag(tagName: string): Ape.EndpointResponse {
return await this.httpClient.post(`${BASE_PATH}/tags`, {
payload: { tagName },
diff --git a/frontend/src/ts/db.ts b/frontend/src/ts/db.ts
index 3cca5448b..cc7a70448 100644
--- a/frontend/src/ts/db.ts
+++ b/frontend/src/ts/db.ts
@@ -55,9 +55,8 @@ export async function initSnapshot(): Promise<
//getData recreates the user if it doesnt exist - thats why it needs to be called first, by itself
const userResponse = await Ape.users.getData();
- const [configResponse, tagsResponse, presetsResponse] = await Promise.all([
+ const [configResponse, presetsResponse] = await Promise.all([
Ape.configs.get(),
- Ape.users.getTags(),
Ape.presets.get(),
]);
@@ -73,12 +72,6 @@ export async function initSnapshot(): Promise<
responseCode: configResponse.status,
};
}
- if (tagsResponse.status !== 200) {
- throw {
- message: `${tagsResponse.message} (tags)`,
- responseCode: tagsResponse.status,
- };
- }
if (presetsResponse.status !== 200) {
throw {
message: `${presetsResponse.message} (presets)`,
@@ -86,10 +79,9 @@ export async function initSnapshot(): Promise<
};
}
- const [userData, configData, tagsData, presetsData] = [
+ const [userData, configData, presetsData] = [
userResponse,
configResponse,
- tagsResponse,
presetsResponse,
].map((response) => response.data);
@@ -170,7 +162,7 @@ export async function initSnapshot(): Promise<
// }
// LoadingPage.updateText("Downloading tags...");
snap.customThemes = userData.customThemes ?? [];
- snap.tags = tagsData;
+ snap.tags = userData.tags || [];
snap.tags.forEach((tag) => {
tag.display = tag.name.replaceAll("_", " ");