1
0
Fork 0
mirror of https://github.com/pawelmalak/flame.git synced 2025-08-07 03:35:18 +02:00

Cleaned up Apps component. Delete App redux action. Apps edit mode with functionality do delete and pin apps

This commit is contained in:
unknown 2021-05-13 18:23:12 +02:00
parent 7e540587a5
commit cb0b4b495f
10 changed files with 225 additions and 52 deletions

View file

@ -60,6 +60,15 @@ const addAppSuccess = (state: State, action: Action): State => {
}
}
const deleteApp = (state: State, action: Action): State => {
const tmpApps = [...state.apps].filter((app: App) => app.id !== action.payload);
return {
...state,
apps: tmpApps
}
}
const appReducer = (state = initialState, action: Action) => {
switch (action.type) {
case ActionTypes.getApps: return getApps(state, action);
@ -67,6 +76,7 @@ const appReducer = (state = initialState, action: Action) => {
case ActionTypes.getAppsError: return getAppsError(state, action);
case ActionTypes.pinApp: return pinApp(state, action);
case ActionTypes.addAppSuccess: return addAppSuccess(state, action);
case ActionTypes.deleteApp: return deleteApp(state, action);
default: return state;
}
}