Change login call from query to mutation.

This commit is contained in:
elweyn 2022-09-22 11:47:48 +02:00
parent e844bcc925
commit f63bfa871a
3 changed files with 21 additions and 22 deletions

View File

@ -136,3 +136,21 @@ export const createContributionMessage = gql`
} }
} }
` `
export const login = gql`
mutation($email: String!, $password: String!, $publisherId: Int) {
login(email: $email, password: $password, publisherId: $publisherId) {
email
firstName
lastName
language
klickTipp {
newsletterState
}
hasElopage
publisherId
isAdmin
creation
}
}
`

View File

@ -1,23 +1,5 @@
import gql from 'graphql-tag' import gql from 'graphql-tag'
export const login = gql`
query($email: String!, $password: String!, $publisherId: Int) {
login(email: $email, password: $password, publisherId: $publisherId) {
email
firstName
lastName
language
klickTipp {
newsletterState
}
hasElopage
publisherId
isAdmin
creation
}
}
`
export const verifyLogin = gql` export const verifyLogin = gql`
query { query {
verifyLogin { verifyLogin {

View File

@ -43,7 +43,7 @@
import InputPassword from '@/components/Inputs/InputPassword' import InputPassword from '@/components/Inputs/InputPassword'
import InputEmail from '@/components/Inputs/InputEmail' import InputEmail from '@/components/Inputs/InputEmail'
import Message from '@/components/Message/Message' import Message from '@/components/Message/Message'
import { login } from '@/graphql/queries' import { login } from '@/graphql/mutations'
export default { export default {
name: 'Login', name: 'Login',
@ -71,14 +71,13 @@ export default {
container: this.$refs.submitButton, container: this.$refs.submitButton,
}) })
this.$apollo this.$apollo
.query({ .mutate({
query: login, mutation: login,
variables: { variables: {
email: this.form.email, email: this.form.email,
password: this.form.password, password: this.form.password,
publisherId: this.$store.state.publisherId, publisherId: this.$store.state.publisherId,
}, },
fetchPolicy: 'network-only',
}) })
.then(async (result) => { .then(async (result) => {
const { const {