mirror of
https://github.com/cheeaun/phanpy.git
synced 2025-01-27 19:16:32 +01:00
71b50382e9
For now, this only works for unsent unsaved drafts e.g. the browser kill the page without giving the user the chance to discard
18 lines
472 B
JavaScript
18 lines
472 B
JavaScript
import store from './store';
|
|
|
|
export function getCurrentAccount() {
|
|
const accounts = store.local.getJSON('accounts') || [];
|
|
const currentAccount = store.session.get('currentAccount');
|
|
const account =
|
|
accounts.find((a) => a.info.id === currentAccount) || accounts[0];
|
|
return account;
|
|
}
|
|
|
|
export function getCurrentAccountNS() {
|
|
const account = getCurrentAccount();
|
|
const {
|
|
instanceURL,
|
|
info: { id },
|
|
} = account;
|
|
return `${id}@${instanceURL}`;
|
|
}
|