Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/graphql/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -646,10 +646,10 @@ export const resolvers: IResolvers<any, ApolloContext> = {
},
Mutation: {
writePost: async (parent: any, args, ctx) => {
return await postService.write(args, ctx.cookies);
return await postService.write(args, ctx.cookies, ctx.ip);
},
editPost: async (parent: any, args, ctx) => {
return await postService.edit(args, ctx.cookies);
return await postService.edit(args, ctx.cookies, ctx.ip);
},
removePost: async (parent: any, args, ctx) => {
const { id } = args as { id: string };
Expand Down
6 changes: 4 additions & 2 deletions src/services/postService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ const postService = {
}
},

async write(args: WritePostArgs, cookies: Cookies) {
async write(args: WritePostArgs, cookies: Cookies, ip: string) {
const WRITE_POST_MUTATION = `
mutation WritePost($input: WritePostInput!) {
writePost(input: $input) {
Expand Down Expand Up @@ -355,6 +355,7 @@ const postService = {
headers: {
'Content-Type': 'application/json',
authorization: `Bearer ${accessToken}`,
'X-Forwarded-For': ip,
},
}
);
Expand All @@ -364,7 +365,7 @@ const postService = {
console.log('write post error', error);
}
},
async edit(args: EditPostArgs, cookies: Cookies) {
async edit(args: EditPostArgs, cookies: Cookies, ip: string) {
const EDIT_POST_MUTATION = `
mutation EditPost($input: EditPostInput!) {
editPost(input: $input) {
Expand Down Expand Up @@ -396,6 +397,7 @@ const postService = {
headers: {
'Content-Type': 'application/json',
authorization: `Bearer ${accessToken}`,
'X-Forwarded-For': ip,
},
}
);
Expand Down