General settings (#28)

adding ui for general settings | adding 'working hours' as new feature
This commit is contained in:
Christian Kellner
2021-05-30 09:37:45 +02:00
committed by GitHub
parent 2899dfc20d
commit 97858b7539
18 changed files with 691 additions and 268 deletions

View File

@@ -0,0 +1,26 @@
import { xhrGet } from '../../xhr';
export const generalSettings = {
state: {
settings: {},
},
reducers: {
//only admins
setGeneralSettings: (state, payload) => {
return {
...state,
settings: payload,
};
},
},
effects: {
async getGeneralSettings() {
try {
const response = await xhrGet('/api/admin/generalSettings');
this.setGeneralSettings(response.json);
} catch (Exception) {
console.error('Error while trying to get resource for api/admin/generalSettings. Error:', Exception);
}
},
},
};

View File

@@ -1,4 +1,5 @@
import { notificationAdapter } from './models/notificationAdapter';
import { generalSettings } from './models/generalSettings';
import createLoadingPlugin from '@rematch/loading';
import { provider } from './models/provider';
import { createLogger } from 'redux-logger';
@@ -17,6 +18,7 @@ const store = init({
name: 'fredy',
models: {
notificationAdapter,
generalSettings,
provider,
jobs,
user,