File tree Expand file tree Collapse file tree 3 files changed +77
-8
lines changed
Expand file tree Collapse file tree 3 files changed +77
-8
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,7 @@ export const ALL_PROJECTS_QUERY = gql`
4444 dbId
4545 email
4646 }
47+ isBlocked
4748 }
4849 }
4950 pageInfo {
@@ -90,6 +91,7 @@ export const PROJECT_QUERY = gql`
9091 dbId
9192 username
9293 }
94+ isBlocked
9395 }
9496 }
9597`
@@ -101,6 +103,7 @@ export const USER_QUERY = gql`
101103 email
102104 latitude
103105 longitude
106+ isBlocked
104107 }
105108 }
106109`
@@ -116,3 +119,33 @@ export const CATEGORIES_QUERY = gql`
116119 }
117120 }
118121`
122+
123+ export const BLOCK_USER_MUTATION = gql `
124+ mutation BlockUser($userId: Int!) {
125+ mutateBlockUser(userId: $userId) {
126+ isBlocked
127+ }
128+ }
129+ `
130+
131+ export const UNBLOCK_USER_MUTATION = gql `
132+ mutation UnblockUser($userId: Int!) {
133+ mutateUnblockUser(userId: $userId){
134+ isBlocked
135+ }
136+ }
137+ `
138+ export const BLOCK_PROJECT_MUTATION = gql `
139+ mutation BlockProject($idProject: Int!) {
140+ mutateBlockProject(idProject: $idProject){
141+ isBlocked
142+ }
143+ }
144+ `
145+ export const UNBLOCK_PROJECT_MUTATION = gql `
146+ mutation UnblockProject($idProject: Int!) {
147+ mutateUnblockProject(idProject: $idProject){
148+ isBlocked
149+ }
150+ }
151+ `
Original file line number Diff line number Diff line change 309309
310310<script >
311311import InvestorsTable from ' @/components/InvestorsTable'
312- import { PROJECT_QUERY } from ' .. /graphql/graphql'
312+ import { PROJECT_QUERY , BLOCK_PROJECT_MUTATION , UNBLOCK_PROJECT_MUTATION } from ' @ /graphql/graphql'
313313
314314export default {
315315 components: {
@@ -387,7 +387,7 @@ export default {
387387 return this .$route .params .id
388388 },
389389 isBlocked () {
390- return this .mockProject .isBlocked
390+ return this .project .isBlocked
391391 },
392392 items () {
393393 return [{
@@ -407,12 +407,30 @@ export default {
407407
408408 methods: {
409409 blockProject () {
410- this .mockProject .isBlocked = true
411410 this .dialog = false
411+ this .$apollo .mutate ({
412+ mutation: BLOCK_PROJECT_MUTATION ,
413+ variables: {
414+ idProject: this .id
415+ }
416+ }).then (() => {
417+ this .project .isBlocked = true
418+ }).catch ((error ) => {
419+ console .error (error)
420+ })
412421 },
413422 unblockProject () {
414- this .mockProject .isBlocked = false
415423 this .dialog = false
424+ this .$apollo .mutate ({
425+ mutation: UNBLOCK_PROJECT_MUTATION ,
426+ variables: {
427+ idProject: this .id
428+ }
429+ }).then (() => {
430+ this .project .isBlocked = false
431+ }).catch ((error ) => {
432+ console .error (error)
433+ })
416434 }
417435 },
418436
Original file line number Diff line number Diff line change 274274<script >
275275import Map from ' @/components/Map'
276276import ProjectsTable from ' @/components/ProjectsTable'
277- import { USER_QUERY } from ' .. /graphql/graphql'
277+ import { BLOCK_USER_MUTATION , UNBLOCK_USER_MUTATION , USER_QUERY } from ' @ /graphql/graphql'
278278
279279export default {
280280 components: {
@@ -313,7 +313,7 @@ export default {
313313 return this .$route .params .id
314314 },
315315 isBlocked () {
316- return this .mockUser .isBlocked
316+ return this .user .isBlocked
317317 },
318318 isSeeder () {
319319 return this .mockUser .isSeeder
@@ -342,12 +342,30 @@ export default {
342342
343343 methods: {
344344 blockUser () {
345- this .mockUser .isBlocked = true
346345 this .dialog = false
346+ this .$apollo .mutate ({
347+ mutation: BLOCK_USER_MUTATION ,
348+ variables: {
349+ userId: this .id
350+ }
351+ }).then (() => {
352+ this .user .isBlocked = true
353+ }).catch ((error ) => {
354+ console .error (error)
355+ })
347356 },
348357 unblockUser () {
349- this .mockUser .isBlocked = false
350358 this .dialog = false
359+ this .$apollo .mutate ({
360+ mutation: UNBLOCK_USER_MUTATION ,
361+ variables: {
362+ userId: this .id
363+ }
364+ }).then (() => {
365+ this .user .isBlocked = false
366+ }).catch ((error ) => {
367+ console .error (error)
368+ })
351369 }
352370 },
353371
You can’t perform that action at this time.
0 commit comments