From ca67ff3496bcc96d82bd6fd76581baa3a760a991 Mon Sep 17 00:00:00 2001 From: Stepan Usatiuk Date: Wed, 14 Oct 2020 21:18:38 +0300 Subject: [PATCH] reset photos when logout --- frontend/src/redux/photos/reducer.ts | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frontend/src/redux/photos/reducer.ts b/frontend/src/redux/photos/reducer.ts index d87467d..d32e020 100644 --- a/frontend/src/redux/photos/reducer.ts +++ b/frontend/src/redux/photos/reducer.ts @@ -1,5 +1,6 @@ import { Reducer } from "redux"; import { IPhotoReqJSON } from "~../../src/entity/Photo"; +import { UserAction, UserTypes } from "~redux/user/actions"; import { PhotoAction, PhotoTypes } from "./actions"; export interface IPhotosState { @@ -18,9 +19,11 @@ const defaultPhotosState: IPhotosState = { export const photosReducer: Reducer = ( state: IPhotosState = defaultPhotosState, - action: PhotoAction, + action: PhotoAction | UserAction, ) => { switch (action.type) { + case UserTypes.USER_LOGOUT: + return defaultPhotosState; case PhotoTypes.PHOTOS_LOAD_START: return { ...defaultPhotosState,