actionUserUpsert.js 479 B

12345678910111213141516171819202122
  1. import { gql } from "../helpers";
  2. import { actionPromise } from "../reducers";
  3. export const actionUserUpsert = (user) => {
  4. if (!user?.password?.length) {
  5. delete user.password;
  6. }
  7. return actionPromise(
  8. "userUpsert",
  9. gql(
  10. `mutation userUpsert($user:UserInput!){
  11. UserUpsert(user:$user){
  12. _id username
  13. }
  14. }`,
  15. {
  16. user,
  17. }
  18. )
  19. );
  20. };