upend/webui/src/lib/util/info.ts

23 lines
602 B
TypeScript

import api from '$lib/api';
import { readable, type Readable } from 'svelte/store';
import type { VaultInfo } from '@upnd/upend/types';
import type { VaultOptions } from '@upnd/upend/api';
export const vaultInfo: Readable<VaultInfo | undefined> = readable(
undefined as VaultInfo | undefined,
(set) => {
api.fetchInfo().then(async (info: VaultInfo) => {
set(info);
});
}
);
export const vaultOptions: Readable<VaultOptions | undefined> = readable(
undefined as VaultOptions | undefined,
(set) => {
api.fetchOptions().then(async (options: VaultOptions) => {
set(options);
});
}
);