commit
4047a7ec23
378 changed files with 29334 additions and 0 deletions
29
redux/actions/websites.js
Normal file
29
redux/actions/websites.js
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
import { createSlice } from '@reduxjs/toolkit';
|
||||
|
||||
const websites = createSlice({
|
||||
name: 'websites',
|
||||
initialState: {},
|
||||
reducers: {
|
||||
updateWebsites(state, action) {
|
||||
state = action.payload;
|
||||
return state;
|
||||
},
|
||||
updateWebsite(state, action) {
|
||||
const { websiteId, ...data } = action.payload;
|
||||
state[websiteId] = data;
|
||||
return state;
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
export const { updateWebsites, updateWebsite } = websites.actions;
|
||||
|
||||
export default websites.reducer;
|
||||
|
||||
export function setDateRange(websiteId, dateRange) {
|
||||
return dispatch => {
|
||||
return dispatch(
|
||||
updateWebsite({ websiteId, dateRange: { ...dateRange, modified: Date.now() } }),
|
||||
);
|
||||
};
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue