From ccff221921df471dba61555671362fdbf187d809 Mon Sep 17 00:00:00 2001 From: Jun Siang Cheah Date: Sun, 26 May 2024 17:12:52 +0100 Subject: [PATCH] refac: run admin general settings fetches in parallel --- .../components/admin/Settings/General.svelte | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/lib/components/admin/Settings/General.svelte b/src/lib/components/admin/Settings/General.svelte index 5674916d6..53246bf59 100644 --- a/src/lib/components/admin/Settings/General.svelte +++ b/src/lib/components/admin/Settings/General.svelte @@ -36,10 +36,20 @@ }; onMount(async () => { - signUpEnabled = await getSignUpEnabledStatus(localStorage.token); - defaultUserRole = await getDefaultUserRole(localStorage.token); - JWTExpiresIn = await getJWTExpiresDuration(localStorage.token); - webhookUrl = await getWebhookUrl(localStorage.token); + await Promise.all([ + (async () => { + signUpEnabled = await getSignUpEnabledStatus(localStorage.token); + })(), + (async () => { + defaultUserRole = await getDefaultUserRole(localStorage.token); + })(), + (async () => { + JWTExpiresIn = await getJWTExpiresDuration(localStorage.token); + })(), + (async () => { + webhookUrl = await getWebhookUrl(localStorage.token); + })() + ]); });