This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
applyMiddleware, | |
createStore, | |
Middleware, | |
Store, | |
AnyAction, | |
compose, | |
Reducer, | |
StoreEnhancer | |
} from 'redux'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { ThunkAction } from 'redux-thunk'; | |
import API from '../constants/apiEndpoints'; | |
type ThunkResult<R> = ThunkAction<R, IinitialState, undefined, any>; | |
export function updateProduct(product: Iproduct): ThunkResult<void> { | |
return (dispatch, getState) => { | |
const originalProduct = getState().manageInventory.data.find( | |
prod => prod.id === product.id | |
); | |
// find() potentially returns undefined. Should never happen since we have to have a product in order to edit it. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { | |
applyMiddleware, | |
createStore, | |
Middleware, | |
Store, | |
AnyAction, | |
compose | |
} from 'redux'; | |
import { createOffline } from '@redux-offline/redux-offline'; | |
// use redux-persist v5 because it has built in support for migrations |