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