dyomedea/src/db/settings.ts

17 lines
393 B
TypeScript
Raw Normal View History

2022-12-25 15:30:47 +00:00
import { get, put } from './lib';
const emptySettings = {};
2022-12-25 15:30:47 +00:00
export const getSettings = async () => {
try {
return (await get('settings', true)).doc;
2022-12-25 15:30:47 +00:00
} catch (err) {
console.error({ caller: 'getSettings', err });
return emptySettings;
2022-12-25 15:30:47 +00:00
}
};
export const putSettings = async (settings: any) => {
return await put('settings', 'settings', (_: any) => settings, {}, true);
};