dyomedea/src/db/settings.ts

18 lines
422 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
}
};
2022-12-26 16:31:05 +00:00
export const putSettings = async (params: any) => {
const { settings } = params;
2022-12-25 15:30:47 +00:00
return await put('settings', 'settings', (_: any) => settings, {}, true);
};