We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7983648 commit 8a4715aCopy full SHA for 8a4715a
src/modules/user/Logout.ts
@@ -1,14 +1,18 @@
1
-import {Resolver, Mutation, Ctx} from "type-graphql"
+import { Resolver, Mutation, Ctx } from "type-graphql"
2
import { MyContext } from "../../types/MyContext";
3
4
@Resolver()
5
export class LogoutResolver {
6
- @Mutation()
7
- async logout(@Ctx() context:MyContext) {
8
- context.req.session!.destroy(err => {
9
- if (err) {
10
- console.log(err)
11
- }
12
- });
+ @Mutation(() => Boolean)
+ async logout(@Ctx() context: MyContext): Promise<Boolean> {
+ return new Promise(
+ (res, rej) => context.req.session!.destroy(err => {
+ if (err) {
+ console.log(err);
+ rej(false);
13
+ }
14
+ res(true);
15
+ })
16
+ );
17
}
18
0 commit comments