Created
February 8, 2019 00:22
-
-
Save ctrlplusb/d0b9fcb2cae813d1db5ce5d7c2906b86 to your computer and use it in GitHub Desktop.
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 { thunk } from "easy-peasy"; // 👈 | |
const store = createStore<StoreModel>({ | |
todos: { | |
items: ["Install easy-peasy", "Build app", "profit"], | |
// 👇renamed | |
saved: (state, payload) => { | |
state.items.push(payload); | |
}, | |
// 👇our thunk | |
save: thunk(async (actions, payload) => { | |
await todoService.save(payload); | |
actions.saved(payload); | |
}) | |
}, | |
// ... | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment