Kliko/lib/store/dataStore.tsx
2024-08-12 16:48:41 +02:00

48 lines
1.2 KiB
TypeScript

// dataStore.js
import { createSlice } from '@reduxjs/toolkit';
const dataStore = createSlice( {
name: 'data',
initialState: {
session: {
token: '',
name: '',
device: '',
language: 'nl',
address: {
id: 0,
zipcode: '',
houseNumber: '',
street: '',
city: '',
},
coordinates: {
latitude: '',
longitude: '',
},
notifications: {
dayBefore: 'off',
sameDay: 'off',
},
},
reloadCalendar: true,
viewCategory: null,
},
reducers: {
setSession: (state, action) => {
state.session = action.payload;
},
setReloadCalendar: (state, action) => {
state.reloadCalendar = action.payload;
},
setViewCategory: (state, action) => {
state.viewCategory = action.payload;
},
},
} );
export const { setSession } = dataStore.actions;
export const { setReloadCalendar } = dataStore.actions;
export const { setViewCategory } = dataStore.actions;
export default dataStore.reducer;