Skip to content

Commit

Permalink
create signout mutation with resolver
Browse files Browse the repository at this point in the history
  • Loading branch information
drillprop committed Feb 25, 2019
1 parent b623520 commit f7749ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/graphql/resolvers/Mutation.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ const Mutation = {
maxAge: 1000 * 60 * 60 * 24 * 365
});
return user;
},
signout: (parent, args, ctx, info) => {
ctx.res.clearCookie('token');
return { message: 'succes' };
}
};

Expand Down
4 changes: 4 additions & 0 deletions src/graphql/schema.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
import { gql } from 'apollo-server-express';

const typeDefs = gql`
type SuccessMessage {
message: String
}
type Query {
albumslastfm(search: String!): [Album]
albums(search: String, last: Int): [Album]
Expand All @@ -14,6 +17,7 @@ const typeDefs = gql`
avatar: String
): User
signin(email: String!, password: String!): User
signout: SuccessMessage
createCd(title: String!, artist: String!, image: String, id: String): Album
}
type User {
Expand Down

0 comments on commit f7749ae

Please sign in to comment.