forked from FoundKeyGang/FoundKey
client: fetch meta via GET
This commit is contained in:
parent
9022ab9f2a
commit
4f9504d135
1 changed files with 2 additions and 8 deletions
|
@ -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));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue