1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-08-07 11:55:17 +02:00

Added option to set custom day and month

This commit is contained in:
Paweł Malak 2021-11-05 17:16:19 +01:00
parent 7febd59ad7
commit bce51bb2c4
12 changed files with 99 additions and 9 deletions

View file

@ -3,6 +3,7 @@ import { Dispatch } from 'redux';
import { ActionTypes } from './actionTypes';
import { Config, ApiResponse, Query } from '../../interfaces';
import { CreateNotificationAction } from './notification';
import { storeUIConfig } from '../../utility';
export interface GetConfigAction {
type: ActionTypes.getConfig;
@ -22,8 +23,15 @@ export const getConfig = () => async (dispatch: Dispatch) => {
document.title = res.data.data.customTitle;
// Store settings for priority UI elements
localStorage.setItem('useAmericanDate', `${res.data.data.useAmericanDate}`);
localStorage.setItem('greetingsSchema', `${res.data.data.greetingsSchema}`);
const keys: (keyof Config)[] = [
'useAmericanDate',
'greetingsSchema',
'daySchema',
'monthSchema',
];
for (let key of keys) {
storeUIConfig(key, res.data.data);
}
} catch (err) {
console.log(err);
}
@ -52,8 +60,15 @@ export const updateConfig = (formData: any) => async (dispatch: Dispatch) => {
});
// Store settings for priority UI elements
localStorage.setItem('useAmericanDate', `${res.data.data.useAmericanDate}`);
localStorage.setItem('greetingsSchema', `${res.data.data.greetingsSchema}`);
const keys: (keyof Config)[] = [
'useAmericanDate',
'greetingsSchema',
'daySchema',
'monthSchema',
];
for (let key of keys) {
storeUIConfig(key, res.data.data);
}
} catch (err) {
console.log(err);
}

View file

@ -10,7 +10,7 @@ export interface State {
const initialState: State = {
loading: true,
config: configTemplate,
config: { ...configTemplate },
customQueries: [],
};