From ce1b3f918886f4a72f42d289a2abfa8d4a4505ca Mon Sep 17 00:00:00 2001 From: tamaina Date: Thu, 28 Jan 2021 04:01:55 +0900 Subject: [PATCH] account migration --- src/client/account.ts | 5 ++--- src/client/init.ts | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/client/account.ts b/src/client/account.ts index 323dd52afd..21592c9044 100644 --- a/src/client/account.ts +++ b/src/client/account.ts @@ -44,9 +44,8 @@ export async function signout() { else location.href = '/'; } -export async function getAccounts() { - const accounts: { id: Account['id'], token: Account['token'] }[] = (await get('accounts')) || []; - return accounts; +export async function getAccounts(): Promise<{ id: Account['id'], token: Account['token'] }[]> { + return (await get('accounts')) || []; } export async function addAccount(id: Account['id'], token: Account['token']) { diff --git a/src/client/init.ts b/src/client/init.ts index f305a89aa5..3a218f4750 100644 --- a/src/client/init.ts +++ b/src/client/init.ts @@ -38,6 +38,11 @@ if (localStorage.getItem('vuex') != null) { location.reload(); } +if (localStorage.getItem('accounts') != null) { + set('accounts', JSON.parse(localStorage.getItem('accounts'))); + localStorage.removeItem('accounts'); +} + import * as Sentry from '@sentry/browser'; import { Integrations } from '@sentry/tracing'; import { createApp, toRaw, watch } from 'vue';