List won't refresh after add


#1

I created an ApolloGraphQl / Angular 4 project, the add function work perfectly, on the client side i need to refresh the page to get my value.

I want it to be instant.

Is there a way to do it ?

provider.ts

  addUserTojob(email: string, job: string) {
    return this.graphql.apollo.mutate({
      mutation: addUserTojob
      variables: {
        email,
        jobId
      },
      update: (store, data) => {
        const box = store.readQuery({ query: getJobs })
        box['getInfo']['sender.email'] = data.data.addUserTojob
        store.writeQuery({ query: getAJobs data: box });
      }
    })
  }

test.ts

addUserTojob(email: string) {
this.alertCtrl.create({
inputs: [
{
name: ‘email’,
},
],
buttons: [
{
text: this.translations.BUTTONS.CANCEL,
},
{
text: this.translations.BUTTONS.CONFIRM,
handler: ({ email }) => {
if (!email || email.length > 50) {
return
}
this.testProvider.addUserToJob(email, this.selectedJob._id).subscribe(
(succeed) => {
this.toastCtrl.create({
message: this.translations.CONFIRM
duration: 3000
}).present()
},
(error) => {
this.toastCtrl.create({
message: this.translations.ERROR
duration: 3000
})
.present()

          })

      }

All thing is working but the UI doesn’t