client: fetch meta via GET

This commit is contained in:
Johann150 2022-10-10 17:36:50 +02:00
parent 9022ab9f2a
commit 4f9504d135
Signed by untrusted user: Johann150
GPG key ID: 9EE6577A2A06F8F1

View file

@ -1,6 +1,6 @@
import { computed, reactive } from 'vue'; import { computed, reactive } from 'vue';
import * as foundkey from 'foundkey-js'; import * as foundkey from 'foundkey-js';
import { api } from '@/os'; import { apiGet } from '@/os';
// TODO: 他のタブと永続化されたstateを同期 // TODO: 他のタブと永続化されたstateを同期
@ -13,13 +13,7 @@ export const instance: foundkey.entities.InstanceMetadata = reactive(instanceDat
}); });
export async function fetchInstance(): Promise<void> { export async function fetchInstance(): Promise<void> {
const meta = await api('meta', { Object.assign(instance, await apiGet('meta'));
detail: false,
});
for (const [k, v] of Object.entries(meta)) {
instance[k] = v;
}
localStorage.setItem('instance', JSON.stringify(instance)); localStorage.setItem('instance', JSON.stringify(instance));
} }