1
0
Fork 0
mirror of https://github.com/cheeaun/phanpy.git synced 2025-04-30 12:22:12 +03:00

Refactor set/get current account ID

And add fallback for standalone mode where session storage is not enough
This commit is contained in:
Lim Chee Aun 2024-04-13 00:06:34 +08:00
parent aefda31c2a
commit e782cc0dde
13 changed files with 57 additions and 27 deletions
src/utils

View file

@ -7,6 +7,7 @@ import {
getAccountByInstance,
getCurrentAccount,
saveAccount,
setCurrentAccountID,
} from './store-utils';
// Default *fallback* instance
@ -118,7 +119,7 @@ export async function initAccount(client, instance, accessToken, vapidKey) {
const mastoAccount = await masto.v1.accounts.verifyCredentials();
console.log('CURRENTACCOUNT SET', mastoAccount.id);
store.session.set('currentAccount', mastoAccount.id);
setCurrentAccountID(mastoAccount.id);
saveAccount({
info: mastoAccount,