1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253 |
- import {actionPromise, gql} from "./index";
- const actionOrdersFind = (data) => {
- return async dispatch => {
- const queryJson = JSON.stringify(
- [{"___owner" : data}]
- )
- await dispatch(actionPromise("ordersFind", gql (
- `query orders ($query: String) {
- OrderFind(query: $query){
- total
- _id
- orderGoods {count, _id, price, good {name, _id, price, images {url}}}
- createdAt
- owner {
- login
- }
-
- }
- }`, {query: queryJson}
- )))
- }
- }
- const actionOrderFindOne = (_id) => {
- return async dispatch => {
- const queryJson = JSON.stringify([{
- "_id": `${_id}`
- }]);
- await dispatch(actionPromise("oneOrder", gql(
- `query oneOrder($query: String) {
- OrderFindOne(query: $query) {
- total
- _id
- orderGoods {count, _id, price, good {name, _id, price, images {url}}}
- createdAt
- }
- }`, {query: queryJson}
- )))
- }
- }
- export {actionOrdersFind, actionOrderFindOne};
|