reset photos when logout

This commit is contained in:
2020-10-14 21:18:38 +03:00
committed by Stepan Usatiuk
parent 6e7c6ae566
commit ca67ff3496

View File

@@ -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<IPhotosState, PhotoAction> = (
state: IPhotosState = defaultPhotosState,
action: PhotoAction,
action: PhotoAction | UserAction,
) => {
switch (action.type) {
case UserTypes.USER_LOGOUT:
return defaultPhotosState;
case PhotoTypes.PHOTOS_LOAD_START:
return {
...defaultPhotosState,