actionAboutMe.js 876 B

1234567891011121314151617181920212223242526272829303132333435
  1. import { gql } from "../helpers";
  2. import { actionPromise } from "../reducers";
  3. import { promiseWatcher, promiseWorker } from "../reducers/promiseReducer";
  4. import { call, select } from "redux-saga/effects";
  5. export const actionAboutMe = () => ({ type: "ABOUT_ME" });
  6. export function* aboutMeWorker() {
  7. const {
  8. auth: {
  9. payload: {
  10. sub: { _id },
  11. },
  12. },
  13. } = yield select();
  14. yield call(
  15. promiseWorker,
  16. actionPromise(
  17. "aboutMe",
  18. gql(
  19. `query AboutMe($q:String){
  20. UserFindOne(query:$q){
  21. _id username name nick avatar{
  22. _id url
  23. }
  24. }
  25. }`,
  26. {
  27. q: JSON.stringify([{ _id }]),
  28. }
  29. )
  30. )
  31. );
  32. }