Skip to content

Mutation completes, but subsequent action call and redirect not working #5

@TheoMer

Description

@TheoMer

I'm having a bit of an issue whereby upon firing a login mutation 'data' returns a user token. The token should then be stored via an action call, and the user is then redirected to the main site.

But the token action and the redirect are not acted upon, and the action to complete a user login simply continues to cycle round over and over (See image).

What is the issue here?

store.js

        effect: (effect, action) => {
          switch (effect.type) {
            case 'query':
              return client.query({...effect}).then(({data}) => data);
            case 'mutation':
              return client.mutate({...effect})
              .then(({data}) => {
                store.dispatch(authToken(data.signinUser.token));
                this.context.router.history.push('/');
              });
            default:
          }
        }

error

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions