jjackson0228 / Pawsitive-Connection

0 stars 0 forks source link

create /client/utils/mutaitions.js #16

Open jjackson0228 opened 3 days ago

jjackson0228 commented 3 days ago

Use data for mutations that coincide with the models. When we get more going we can update these issues to be more informative. HERE IS AN EXAMPLE: import { gql } from '@apollo/client';

export const LOGIN_USER = gql mutation login($email: String!, $password: String!) { login(email: $email, password: $password) { token user { _id username } } } ;

export const ADD_USER = gql mutation addUser($username: String!, $email: String!, $password: String!) { addUser(username: $username, email: $email, password: $password) { token user { _id username } } } ;

export const ADD_THOUGHT = gql mutation addThought($thoughtText: String!) { addThought(thoughtText: $thoughtText) { _id thoughtText thoughtAuthor createdAt comments { _id commentText } } } ;

export const ADD_COMMENT = gql mutation addComment($thoughtId: ID!, $commentText: String!) { addComment(thoughtId: $thoughtId, commentText: $commentText) { _id thoughtText thoughtAuthor createdAt comments { _id commentText createdAt } } } ;

jjackson0228 commented 3 days ago

ADD_USER, LOGIN_USER, ADD_PET, ADD_COMMENT