Slide 27
Slide 27 text
͜Μͳ͔Μ͡
1 fork('ORDER', async (action, dispatch) => {¬
2 dispatch({ type: 'USER_FETCH', action.payload.userID })¬
3 const { payload } = await merge('USER_FETCHED')¬
4 const resp = await fetch(`/api/orders`, {¬
5 method: 'POST',¬
6 body: JSON.stringify({ productID: action.payload.productID }),¬
7 })¬
8 dispatch({ type: 'ORDERED', payload: JSON.parse(resp.body) })¬
9 })