mirror of
https://github.com/usatiuk/photos.git
synced 2025-10-28 15:27:49 +01:00
reset photos when logout
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user