From 99cef3604f4e3b28405097d51dd609c47e437da0 Mon Sep 17 00:00:00 2001 From: Made Baruna Date: Thu, 23 Dec 2021 22:32:28 +0700 Subject: [PATCH] Add UID on account list --- src/routes/settings/index.svelte | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/src/routes/settings/index.svelte b/src/routes/settings/index.svelte index b90db38c..8dc34661 100644 --- a/src/routes/settings/index.svelte +++ b/src/routes/settings/index.svelte @@ -43,6 +43,7 @@ let selectedServer = null; let arInput = ''; let wlInput = ''; + let accountList = []; function signIn() { gapi.auth2.getAuthInstance().signIn(); @@ -65,6 +66,12 @@ console.log('wl update'); wlInput = val; }); + accounts.subscribe((val) => { + console.log('accounts update'); + getAccountList(val); + }); + + mounted = true; }); function updateServer() { @@ -208,6 +215,16 @@ closeModal(); } + async function getAccountList(accounts) { + accountList = []; + for (const acc of accounts) { + const prefix = acc.value === 'main' ? '' : `${acc.value}-`; + const uid = await readSave(`${prefix}wish-uid`); + accountList.push({ ...acc, label: `${acc.label} ${uid !== null ? `UID:${uid}` : ''}` }); + console.log(prefix, uid); + } + } + function openDeleteAccount() { openModal( DeleteAccountModal, @@ -260,10 +277,6 @@ ); } - onMount(() => { - mounted = true; - }); - $: currentAccount, selectAccount(); $: selectedServer, updateServer(); $: arInput, updateAR(); @@ -291,7 +304,7 @@