aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFuwn <[email protected]>2024-10-07 02:32:36 -0700
committerFuwn <[email protected]>2024-10-07 02:32:36 -0700
commit0e6917a9ec3ec8ada6724e0832acd6643ec2afae (patch)
treef563c5f23947dd3b3cf3627ad7eff96b80a8e935 /src
parentfix(badges): fix field clearing regression (diff)
downloaddue.moe-0e6917a9ec3ec8ada6724e0832acd6643ec2afae.tar.xz
due.moe-0e6917a9ec3ec8ada6724e0832acd6643ec2afae.zip
fix(graphql): wait for database update on badge mutation
Diffstat (limited to 'src')
-rw-r--r--src/graphql/user/resolvers.ts6
-rw-r--r--src/routes/user/[user]/badges/+page.svelte1
2 files changed, 3 insertions, 4 deletions
diff --git a/src/graphql/user/resolvers.ts b/src/graphql/user/resolvers.ts
index 422d9170..2e1160bc 100644
--- a/src/graphql/user/resolvers.ts
+++ b/src/graphql/user/resolvers.ts
@@ -33,7 +33,7 @@ const auth = async (context: Context) => {
const authenticatedBadgesOperation = async (
context: Context,
- operation: (identity: UserIdentity, authorised: boolean) => void
+ operation: (identity: UserIdentity, authorised: boolean) => Promise<any>
) => {
const identity = await auth(context);
@@ -41,7 +41,7 @@ const authenticatedBadgesOperation = async (
const authorised = authorisedJson.includes(identity.id);
- operation(identity, authorised);
+ await operation(identity, authorised);
return {
id: identity.id,
@@ -63,7 +63,7 @@ const authenticatedPreferencesOperation = async (
return {
id: identity.id,
badges: [] as Badge[],
- preferences: operation(identity, authorised) as Promise<UserPreferences>
+ preferences: await operation(identity, authorised)
}
};
diff --git a/src/routes/user/[user]/badges/+page.svelte b/src/routes/user/[user]/badges/+page.svelte
index fda9ad6c..3857d18b 100644
--- a/src/routes/user/[user]/badges/+page.svelte
+++ b/src/routes/user/[user]/badges/+page.svelte
@@ -313,7 +313,6 @@
return;
}
- (document.querySelector(`#badge-${badge.id}`) as HTMLAnchorElement).style.display = 'none';
selectedBadge = undefined;
deleteBadgeQuery