1
0
Fork 0
mirror of https://github.com/cheeaun/phanpy.git synced 2025-05-02 21:23:13 +03:00

Respect your preferences

This commit is contained in:
Lim Chee Aun 2023-02-09 23:59:57 +08:00
parent 2cd235a069
commit 91aeed5fe6
3 changed files with 36 additions and 4 deletions
src/utils

View file

@ -100,6 +100,18 @@ export async function initAccount(client, instance, accessToken) {
});
}
// Get preferences
export async function initPreferences(client) {
try {
const masto = client;
const preferences = await masto.v1.preferences.fetch();
store.account.set('preferences', preferences);
} catch (e) {
// silently fail
console.error(e);
}
}
// Get the masto instance
// If accountID is provided, get the masto instance for that account
export function api({ instance, accessToken, accountID, account } = {}) {