autoAddBoardId should always be defined

This commit is contained in:
Mary Hipp 2023-08-03 15:47:59 -04:00 committed by psychedelicious
parent 05ae4e283c
commit cfc3a20565
2 changed files with 5 additions and 1 deletions

View File

@ -40,7 +40,7 @@ export const addImageUploadedFulfilledListener = () => {
// default action - just upload and alert user
if (postUploadAction?.type === 'TOAST') {
const { toastOptions } = postUploadAction;
if (!autoAddBoardId) {
if (!autoAddBoardId || autoAddBoardId === 'none') {
dispatch(addToast({ ...DEFAULT_UPLOADED_TOAST, ...toastOptions }));
} else {
// Add this image to the board

View File

@ -41,6 +41,10 @@ export const gallerySlice = createSlice({
state.galleryView = 'images';
},
autoAddBoardIdChanged: (state, action: PayloadAction<BoardId>) => {
if (!action.payload) {
state.autoAddBoardId = 'none';
return;
}
state.autoAddBoardId = action.payload;
},
galleryViewChanged: (state, action: PayloadAction<GalleryView>) => {