From fe861795bc87769695b8c6e62c4a99b56a8f0fec Mon Sep 17 00:00:00 2001 From: Chris Walsh Date: Sat, 4 Dec 2021 01:54:17 -0800 Subject: [PATCH] Create new website action and modify redux struct --- redux/actions/websites.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/redux/actions/websites.js b/redux/actions/websites.js index ef6bd872..28bdfe59 100644 --- a/redux/actions/websites.js +++ b/redux/actions/websites.js @@ -10,7 +10,7 @@ const websites = createSlice({ }, updateWebsite(state, action) { const { websiteId, ...data } = action.payload; - state[websiteId] = data; + state[websiteId] = { ...state[websiteId], ...data }; return state; }, }, @@ -27,3 +27,9 @@ export function setDateRange(websiteId, dateRange) { ); }; } + +export function setWebsiteCreated(websiteId, createdAt) { + return dispatch => { + return dispatch(updateWebsite({ websiteId, createdAt })); + }; +}