actionAboutMe.js 746 B

1234567891011121314151617181920212223242526272829
  1. import { gql } from "../helpers";
  2. import { actionPromise } from "../reducers";
  3. export const actionAboutMe = () => async (dispatch, getState) => {
  4. const {
  5. auth: {
  6. payload: {
  7. sub: { _id },
  8. },
  9. },
  10. } = getState();
  11. await dispatch(
  12. actionPromise(
  13. "aboutMe",
  14. gql(
  15. `query AboutMe($q:String){
  16. UserFindOne(query:$q){
  17. _id username name nick avatar{
  18. _id url
  19. }
  20. }
  21. }`,
  22. {
  23. q: JSON.stringify([{ _id }]),
  24. }
  25. )
  26. )
  27. );
  28. };