From 680b3493b3fab96830bbbb89a4fc8d18fce8eb5a Mon Sep 17 00:00:00 2001 From: Anthony Fu Date: Sat, 14 Jan 2023 10:58:46 +0100 Subject: [PATCH] pref: improve current user handle writting --- composables/users.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/composables/users.ts b/composables/users.ts index 2966979e..ac010efb 100644 --- a/composables/users.ts +++ b/composables/users.ts @@ -92,7 +92,10 @@ if (process.client) { }, { immediate: true, flush: 'post' }) // for injected script to read - useLocalStorage(STORAGE_KEY_CURRENT_USER_HANDLE, computed(() => currentUser.value?.account.acct || '')) + const currentUserHandle = computed(() => currentUser.value?.account.acct || '') + watchEffect(() => { + localStorage.setItem(STORAGE_KEY_CURRENT_USER_HANDLE, currentUserHandle.value) + }) } export const useUsers = () => users