mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Merge branch 'master' into apollo_listGDTTransactions
This commit is contained in:
commit
1830b277f8
1
.github/workflows/test.yml
vendored
1
.github/workflows/test.yml
vendored
@ -1,6 +1,5 @@
|
||||
name: gradido test CI
|
||||
|
||||
|
||||
on: [push]
|
||||
|
||||
jobs:
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Resolver, Query, Args, Authorized, Ctx } from 'type-graphql'
|
||||
import { Resolver, Query, Args, Authorized, Ctx, Mutation } from 'type-graphql'
|
||||
import CONFIG from '../../config'
|
||||
import { TransactionList } from '../models/Transaction'
|
||||
import { TransactionListInput, TransactionSendArgs } from '../inputs/TransactionInput'
|
||||
@ -23,7 +23,7 @@ export class TransactionResolver {
|
||||
}
|
||||
|
||||
@Authorized()
|
||||
@Query(() => String)
|
||||
@Mutation(() => String)
|
||||
async sendCoins(
|
||||
@Args() { email, amount, memo }: TransactionSendArgs,
|
||||
@Ctx() context: any,
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
/* eslint-disable @typescript-eslint/no-explicit-any */
|
||||
/* eslint-disable @typescript-eslint/explicit-module-boundary-types */
|
||||
|
||||
import { Resolver, Query, Args, Arg, Authorized, Ctx, UseMiddleware } from 'type-graphql'
|
||||
import { Resolver, Query, Args, Arg, Authorized, Ctx, UseMiddleware, Mutation } from 'type-graphql'
|
||||
import CONFIG from '../../config'
|
||||
import { CheckUsernameResponse } from '../models/CheckUsernameResponse'
|
||||
import { LoginViaVerificationCode } from '../models/LoginViaVerificationCode'
|
||||
@ -66,8 +66,8 @@ export class UserResolver {
|
||||
return 'success'
|
||||
}
|
||||
|
||||
@Query(() => String)
|
||||
async create(
|
||||
@Mutation(() => String)
|
||||
async createUser(
|
||||
@Args() { email, firstName, lastName, password, language }: CreateUserArgs,
|
||||
): Promise<string> {
|
||||
const payload = {
|
||||
@ -104,7 +104,7 @@ export class UserResolver {
|
||||
return new SendPasswordResetEmailResponse(response.data)
|
||||
}
|
||||
|
||||
@Query(() => String)
|
||||
@Mutation(() => String)
|
||||
async resetPassword(
|
||||
@Args()
|
||||
{ sessionId, email, password }: ChangePasswordArgs,
|
||||
@ -122,7 +122,7 @@ export class UserResolver {
|
||||
}
|
||||
|
||||
@Authorized()
|
||||
@Query(() => UpdateUserInfosResponse)
|
||||
@Mutation(() => UpdateUserInfosResponse)
|
||||
async updateUserInfos(
|
||||
@Args()
|
||||
{
|
||||
|
||||
@ -5,7 +5,7 @@ import jwt from 'jsonwebtoken'
|
||||
import CONFIG from '../config/'
|
||||
|
||||
export default (token: string): any => {
|
||||
if (!token) return null
|
||||
if (!token) return new Error('401 Unauthorized')
|
||||
let sessionId = null
|
||||
try {
|
||||
const decoded = jwt.verify(token, CONFIG.JWT_SECRET)
|
||||
@ -15,6 +15,6 @@ export default (token: string): any => {
|
||||
sessionId,
|
||||
}
|
||||
} catch (err) {
|
||||
return null
|
||||
throw new Error('403.13 - Client certificate revoked')
|
||||
}
|
||||
}
|
||||
|
||||
@ -3,7 +3,7 @@ import LanguageSwitch from './LanguageSwitch'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
const updateUserInfosQueryMock = jest.fn().mockResolvedValue({
|
||||
const updateUserInfosMutationMock = jest.fn().mockResolvedValue({
|
||||
data: {
|
||||
updateUserInfos: {
|
||||
validValues: 1,
|
||||
@ -28,7 +28,7 @@ describe('LanguageSwitch', () => {
|
||||
locale: 'en',
|
||||
},
|
||||
$apollo: {
|
||||
query: updateUserInfosQueryMock,
|
||||
mutate: updateUserInfosMutationMock,
|
||||
},
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ describe('LanguageSwitch', () => {
|
||||
describe('calls the API', () => {
|
||||
it("with locale 'en'", () => {
|
||||
wrapper.findAll('li').at(0).find('a').trigger('click')
|
||||
expect(updateUserInfosQueryMock).toBeCalledWith(
|
||||
expect(updateUserInfosMutationMock).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: {
|
||||
email: 'he@ho.he',
|
||||
@ -131,7 +131,7 @@ describe('LanguageSwitch', () => {
|
||||
|
||||
it("with locale 'de'", () => {
|
||||
wrapper.findAll('li').at(1).find('a').trigger('click')
|
||||
expect(updateUserInfosQueryMock).toBeCalledWith(
|
||||
expect(updateUserInfosMutationMock).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: {
|
||||
email: 'he@ho.he',
|
||||
|
||||
@ -14,7 +14,7 @@
|
||||
<script>
|
||||
import { localeChanged } from 'vee-validate'
|
||||
import locales from '../locales/'
|
||||
import { updateUserInfos } from '../graphql/queries'
|
||||
import { updateUserInfos } from '../graphql/mutations'
|
||||
|
||||
export default {
|
||||
name: 'LanguageSwitch',
|
||||
@ -36,8 +36,8 @@ export default {
|
||||
this.setLocale(locale)
|
||||
if (this.$store.state.email) {
|
||||
this.$apollo
|
||||
.query({
|
||||
query: updateUserInfos,
|
||||
.mutate({
|
||||
mutation: updateUserInfos,
|
||||
variables: {
|
||||
email: this.$store.state.email,
|
||||
locale: locale,
|
||||
|
||||
@ -11,3 +11,59 @@ export const unsubscribeNewsletter = gql`
|
||||
unsubscribeNewsletter(email: $email)
|
||||
}
|
||||
`
|
||||
|
||||
export const resetPassword = gql`
|
||||
mutation($sessionId: Float!, $email: String!, $password: String!) {
|
||||
resetPassword(sessionId: $sessionId, email: $email, password: $password)
|
||||
}
|
||||
`
|
||||
|
||||
export const updateUserInfos = gql`
|
||||
mutation(
|
||||
$email: String!
|
||||
$firstName: String
|
||||
$lastName: String
|
||||
$description: String
|
||||
$username: String
|
||||
$password: String
|
||||
$passwordNew: String
|
||||
$locale: String
|
||||
) {
|
||||
updateUserInfos(
|
||||
email: $email
|
||||
firstName: $firstName
|
||||
lastName: $lastName
|
||||
description: $description
|
||||
username: $username
|
||||
password: $password
|
||||
passwordNew: $passwordNew
|
||||
language: $locale
|
||||
) {
|
||||
validValues
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export const registerUser = gql`
|
||||
mutation(
|
||||
$firstName: String!
|
||||
$lastName: String!
|
||||
$email: String!
|
||||
$password: String!
|
||||
$language: String!
|
||||
) {
|
||||
createUser(
|
||||
email: $email
|
||||
firstName: $firstName
|
||||
lastName: $lastName
|
||||
password: $password
|
||||
language: $language
|
||||
)
|
||||
}
|
||||
`
|
||||
|
||||
export const sendCoins = gql`
|
||||
mutation($email: String!, $amount: Float!, $memo: String!) {
|
||||
sendCoins(email: $email, amount: $amount, memo: $memo)
|
||||
}
|
||||
`
|
||||
|
||||
@ -22,12 +22,6 @@ export const logout = gql`
|
||||
}
|
||||
`
|
||||
|
||||
export const resetPassword = gql`
|
||||
query($sessionId: Float!, $email: String!, $password: String!) {
|
||||
resetPassword(sessionId: $sessionId, email: $email, password: $password)
|
||||
}
|
||||
`
|
||||
|
||||
export const loginViaEmailVerificationCode = gql`
|
||||
query($optin: String!) {
|
||||
loginViaEmailVerificationCode(optin: $optin) {
|
||||
@ -37,32 +31,6 @@ export const loginViaEmailVerificationCode = gql`
|
||||
}
|
||||
`
|
||||
|
||||
export const updateUserInfos = gql`
|
||||
query(
|
||||
$email: String!
|
||||
$firstName: String
|
||||
$lastName: String
|
||||
$description: String
|
||||
$username: String
|
||||
$password: String
|
||||
$passwordNew: String
|
||||
$locale: String
|
||||
) {
|
||||
updateUserInfos(
|
||||
email: $email
|
||||
firstName: $firstName
|
||||
lastName: $lastName
|
||||
description: $description
|
||||
username: $username
|
||||
password: $password
|
||||
passwordNew: $passwordNew
|
||||
language: $locale
|
||||
) {
|
||||
validValues
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export const transactionsQuery = gql`
|
||||
query($firstPage: Int = 1, $items: Int = 25, $order: String = "DESC") {
|
||||
transactionList(firstPage: $firstPage, items: $items, order: $order) {
|
||||
@ -94,30 +62,6 @@ export const transactionsQuery = gql`
|
||||
}
|
||||
`
|
||||
|
||||
export const resgisterUserQuery = gql`
|
||||
query(
|
||||
$firstName: String!
|
||||
$lastName: String!
|
||||
$email: String!
|
||||
$password: String!
|
||||
$language: String!
|
||||
) {
|
||||
create(
|
||||
email: $email
|
||||
firstName: $firstName
|
||||
lastName: $lastName
|
||||
password: $password
|
||||
language: $language
|
||||
)
|
||||
}
|
||||
`
|
||||
|
||||
export const sendCoins = gql`
|
||||
query($email: String!, $amount: Float!, $memo: String!) {
|
||||
sendCoins(email: $email, amount: $amount, memo: $memo)
|
||||
}
|
||||
`
|
||||
|
||||
export const sendResetPasswordEmail = gql`
|
||||
query($email: String!) {
|
||||
sendResetPasswordEmail(email: $email) {
|
||||
|
||||
@ -36,7 +36,8 @@
|
||||
"error": {
|
||||
"change-password": "Fehler beim Ändern des Passworts",
|
||||
"error": "Fehler",
|
||||
"no-account": "Leider konnten wir keinen Account finden mit diesen Daten!"
|
||||
"no-account": "Leider konnten wir keinen Account finden mit diesen Daten!",
|
||||
"session-expired": "Sitzung abgelaufen!"
|
||||
},
|
||||
"form": {
|
||||
"amount": "Betrag",
|
||||
|
||||
@ -36,7 +36,8 @@
|
||||
"error": {
|
||||
"change-password": "Error while changing password",
|
||||
"error": "Error",
|
||||
"no-account": "Unfortunately we could not find an account to the given data!"
|
||||
"no-account": "Unfortunately we could not find an account to the given data!",
|
||||
"session-expired": "The session expired"
|
||||
},
|
||||
"form": {
|
||||
"amount": "Amount",
|
||||
|
||||
@ -21,6 +21,12 @@ const authLink = new ApolloLink((operation, forward) => {
|
||||
},
|
||||
})
|
||||
return forward(operation).map((response) => {
|
||||
if (response.errors && response.errors[0].message === '403.13 - Client certificate revoked') {
|
||||
response.errors[0].message = i18n.t('error.session-expired')
|
||||
store.dispatch('logout', null)
|
||||
if (router.currentRoute.path !== '/login') router.push('/login')
|
||||
return response
|
||||
}
|
||||
const newToken = operation.getContext().response.headers.get('token')
|
||||
if (newToken) store.commit('token', newToken)
|
||||
return response
|
||||
|
||||
@ -25,7 +25,7 @@ describe('AccountOverview', () => {
|
||||
},
|
||||
},
|
||||
$apollo: {
|
||||
query: sendMock,
|
||||
mutate: sendMock,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -51,7 +51,7 @@ import GddTransactionListFooter from './AccountOverview/GddTransactionListFooter
|
||||
import TransactionForm from './AccountOverview/GddSend/TransactionForm.vue'
|
||||
import TransactionConfirmation from './AccountOverview/GddSend/TransactionConfirmation.vue'
|
||||
import TransactionResult from './AccountOverview/GddSend/TransactionResult.vue'
|
||||
import { sendCoins } from '../../graphql/queries.js'
|
||||
import { sendCoins } from '../../graphql/mutations.js'
|
||||
|
||||
const EMPTY_TRANSACTION_DATA = {
|
||||
email: '',
|
||||
@ -105,8 +105,8 @@ export default {
|
||||
async sendTransaction() {
|
||||
this.loading = true
|
||||
this.$apollo
|
||||
.query({
|
||||
query: sendCoins,
|
||||
.mutate({
|
||||
mutation: sendCoins,
|
||||
variables: this.transactionData,
|
||||
})
|
||||
.then(() => {
|
||||
|
||||
@ -5,7 +5,7 @@ import Register from './Register'
|
||||
|
||||
const localVue = global.localVue
|
||||
|
||||
const resgisterUserQueryMock = jest.fn()
|
||||
const registerUserMutationMock = jest.fn()
|
||||
const routerPushMock = jest.fn()
|
||||
|
||||
describe('Register', () => {
|
||||
@ -20,10 +20,11 @@ describe('Register', () => {
|
||||
push: routerPushMock,
|
||||
},
|
||||
$apollo: {
|
||||
query: resgisterUserQueryMock,
|
||||
mutate: registerUserMutationMock,
|
||||
},
|
||||
$store: {
|
||||
state: {
|
||||
email: 'peter@lustig.de',
|
||||
language: null,
|
||||
},
|
||||
},
|
||||
@ -192,7 +193,7 @@ describe('Register', () => {
|
||||
|
||||
describe('server sends back error', () => {
|
||||
beforeEach(async () => {
|
||||
resgisterUserQueryMock.mockRejectedValue({ message: 'Ouch!' })
|
||||
registerUserMutationMock.mockRejectedValue({ message: 'Ouch!' })
|
||||
await wrapper.find('form').trigger('submit')
|
||||
await flushPromises()
|
||||
})
|
||||
@ -217,7 +218,7 @@ describe('Register', () => {
|
||||
|
||||
describe('server sends back success', () => {
|
||||
beforeEach(() => {
|
||||
resgisterUserQueryMock.mockResolvedValue({
|
||||
registerUserMutationMock.mockResolvedValue({
|
||||
data: {
|
||||
create: 'success',
|
||||
},
|
||||
@ -227,7 +228,7 @@ describe('Register', () => {
|
||||
it('routes to "/thx/register"', async () => {
|
||||
await wrapper.find('form').trigger('submit')
|
||||
await flushPromises()
|
||||
expect(resgisterUserQueryMock).toBeCalledWith(
|
||||
expect(registerUserMutationMock).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: {
|
||||
email: 'max.mustermann@gradido.net',
|
||||
|
||||
@ -141,7 +141,7 @@
|
||||
import InputEmail from '../../components/Inputs/InputEmail.vue'
|
||||
import InputPasswordConfirmation from '../../components/Inputs/InputPasswordConfirmation.vue'
|
||||
import LanguageSwitchSelect from '../../components/LanguageSwitchSelect.vue'
|
||||
import { resgisterUserQuery } from '../../graphql/queries'
|
||||
import { registerUser } from '../../graphql/mutations'
|
||||
|
||||
export default {
|
||||
components: { InputPasswordConfirmation, InputEmail, LanguageSwitchSelect },
|
||||
@ -190,8 +190,8 @@ export default {
|
||||
},
|
||||
async onSubmit() {
|
||||
this.$apollo
|
||||
.query({
|
||||
query: resgisterUserQuery,
|
||||
.mutate({
|
||||
mutation: registerUser,
|
||||
variables: {
|
||||
email: this.form.email,
|
||||
firstName: this.form.firstname,
|
||||
|
||||
@ -7,6 +7,7 @@ import flushPromises from 'flush-promises'
|
||||
const localVue = global.localVue
|
||||
|
||||
const apolloQueryMock = jest.fn().mockRejectedValue({ message: 'error' })
|
||||
const apolloMutationMock = jest.fn()
|
||||
|
||||
const toasterMock = jest.fn()
|
||||
const routerPushMock = jest.fn()
|
||||
@ -36,6 +37,7 @@ describe('ResetPassword', () => {
|
||||
}),
|
||||
},
|
||||
$apollo: {
|
||||
mutate: apolloMutationMock,
|
||||
query: apolloQueryMock,
|
||||
},
|
||||
}
|
||||
@ -146,7 +148,7 @@ describe('ResetPassword', () => {
|
||||
|
||||
describe('server response with error', () => {
|
||||
beforeEach(() => {
|
||||
apolloQueryMock.mockRejectedValue({ message: 'error' })
|
||||
apolloMutationMock.mockRejectedValue({ message: 'error' })
|
||||
})
|
||||
it('toasts an error message', () => {
|
||||
expect(toasterMock).toHaveBeenCalledWith('error')
|
||||
@ -155,14 +157,14 @@ describe('ResetPassword', () => {
|
||||
|
||||
describe('server response with success', () => {
|
||||
beforeEach(() => {
|
||||
apolloQueryMock.mockResolvedValue({
|
||||
apolloMutationMock.mockResolvedValue({
|
||||
data: {
|
||||
resetPassword: 'success',
|
||||
},
|
||||
})
|
||||
})
|
||||
it('calls the API', () => {
|
||||
expect(apolloQueryMock).toBeCalledWith(
|
||||
expect(apolloMutationMock).toBeCalledWith(
|
||||
expect.objectContaining({
|
||||
variables: {
|
||||
sessionId: 1,
|
||||
|
||||
@ -48,7 +48,8 @@
|
||||
</template>
|
||||
<script>
|
||||
import InputPasswordConfirmation from '../../components/Inputs/InputPasswordConfirmation'
|
||||
import { resetPassword, loginViaEmailVerificationCode } from '../../graphql/queries'
|
||||
import { loginViaEmailVerificationCode } from '../../graphql/queries'
|
||||
import { resetPassword } from '../../graphql/mutations'
|
||||
|
||||
export default {
|
||||
name: 'ResetPassword',
|
||||
@ -71,8 +72,8 @@ export default {
|
||||
methods: {
|
||||
async onSubmit() {
|
||||
this.$apollo
|
||||
.query({
|
||||
query: resetPassword,
|
||||
.mutate({
|
||||
mutation: resetPassword,
|
||||
variables: {
|
||||
sessionId: this.sessionId,
|
||||
email: this.email,
|
||||
|
||||
@ -29,7 +29,7 @@ describe('UserCard_FormUserData', () => {
|
||||
error: toastErrorMock,
|
||||
},
|
||||
$apollo: {
|
||||
query: mockAPIcall,
|
||||
mutate: mockAPIcall,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -72,7 +72,7 @@
|
||||
</b-card>
|
||||
</template>
|
||||
<script>
|
||||
import { updateUserInfos } from '../../../graphql/queries'
|
||||
import { updateUserInfos } from '../../../graphql/mutations'
|
||||
|
||||
export default {
|
||||
name: 'FormUserData',
|
||||
@ -108,8 +108,8 @@ export default {
|
||||
async onSubmit(event) {
|
||||
event.preventDefault()
|
||||
this.$apollo
|
||||
.query({
|
||||
query: updateUserInfos,
|
||||
.mutate({
|
||||
mutation: updateUserInfos,
|
||||
variables: {
|
||||
email: this.$store.state.email,
|
||||
firstName: this.form.firstName,
|
||||
|
||||
@ -21,7 +21,7 @@ describe('UserCard_FormUserMail', () => {
|
||||
},
|
||||
},
|
||||
$apollo: {
|
||||
query: mockAPIcall,
|
||||
mutate: mockAPIcall,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@
|
||||
</b-card>
|
||||
</template>
|
||||
<script>
|
||||
import { updateUserInfos } from '../../../graphql/queries'
|
||||
import { updateUserInfos } from '../../../graphql/mutations'
|
||||
|
||||
export default {
|
||||
name: 'FormUserMail',
|
||||
@ -45,8 +45,8 @@ export default {
|
||||
methods: {
|
||||
async onSubmit() {
|
||||
this.$apollo
|
||||
.query({
|
||||
query: updateUserInfos,
|
||||
.mutate({
|
||||
mutation: updateUserInfos,
|
||||
variables: {
|
||||
email: this.$store.state.email,
|
||||
newEmail: this.newEmail,
|
||||
|
||||
@ -25,7 +25,7 @@ describe('UserCard_FormUserPasswort', () => {
|
||||
error: toastErrorMock,
|
||||
},
|
||||
$apollo: {
|
||||
query: changePasswordProfileMock,
|
||||
mutate: changePasswordProfileMock,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
<script>
|
||||
import InputPassword from '../../../components/Inputs/InputPassword'
|
||||
import InputPasswordConfirmation from '../../../components/Inputs/InputPasswordConfirmation'
|
||||
import { updateUserInfos } from '../../../graphql/queries'
|
||||
import { updateUserInfos } from '../../../graphql/mutations'
|
||||
|
||||
export default {
|
||||
name: 'FormUserPasswort',
|
||||
@ -73,8 +73,8 @@ export default {
|
||||
},
|
||||
async onSubmit() {
|
||||
this.$apollo
|
||||
.query({
|
||||
query: updateUserInfos,
|
||||
.mutate({
|
||||
mutation: updateUserInfos,
|
||||
variables: {
|
||||
email: this.$store.state.email,
|
||||
password: this.form.password,
|
||||
|
||||
@ -35,7 +35,7 @@ describe('UserCard_FormUsername', () => {
|
||||
error: toastErrorMock,
|
||||
},
|
||||
$apollo: {
|
||||
query: mockAPIcall,
|
||||
mutate: mockAPIcall,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -67,7 +67,7 @@
|
||||
</b-card>
|
||||
</template>
|
||||
<script>
|
||||
import { updateUserInfos } from '../../../graphql/queries'
|
||||
import { updateUserInfos } from '../../../graphql/mutations'
|
||||
|
||||
export default {
|
||||
name: 'FormUsername',
|
||||
@ -87,8 +87,8 @@ export default {
|
||||
},
|
||||
async onSubmit() {
|
||||
this.$apollo
|
||||
.query({
|
||||
query: updateUserInfos,
|
||||
.mutate({
|
||||
mutation: updateUserInfos,
|
||||
variables: {
|
||||
email: this.$store.state.email,
|
||||
username: this.form.username,
|
||||
|
||||
@ -25,7 +25,7 @@ describe('UserCard_Language', () => {
|
||||
error: toastErrorMock,
|
||||
},
|
||||
$apollo: {
|
||||
query: mockAPIcall,
|
||||
mutate: mockAPIcall,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@ -46,7 +46,6 @@
|
||||
<div class="text-right" ref="submitButton">
|
||||
<b-button
|
||||
:variant="loading ? 'default' : 'success'"
|
||||
@click="onSubmit"
|
||||
type="submit"
|
||||
class="mt-4"
|
||||
:disabled="loading"
|
||||
@ -64,7 +63,7 @@
|
||||
<script>
|
||||
import { localeChanged } from 'vee-validate'
|
||||
import LanguageSwitchSelect from '../../../components/LanguageSwitchSelect.vue'
|
||||
import { updateUserInfos } from '../../../graphql/queries'
|
||||
import { updateUserInfos } from '../../../graphql/mutations'
|
||||
|
||||
export default {
|
||||
name: 'FormUserLanguage',
|
||||
@ -88,24 +87,24 @@ export default {
|
||||
cancelEdit() {
|
||||
this.showLanguage = true
|
||||
},
|
||||
|
||||
async onSubmit() {
|
||||
this.$apollo
|
||||
.query({
|
||||
query: updateUserInfos,
|
||||
.mutate({
|
||||
mutation: updateUserInfos,
|
||||
variables: {
|
||||
email: this.$store.state.email,
|
||||
locale: this.language,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
this.$store.commit('language', this.language)
|
||||
this.$i18n.locale = this.language
|
||||
this.$store.commit('language', this.$i18n.locale)
|
||||
localeChanged(this.$i18n.locale)
|
||||
localeChanged(this.language)
|
||||
this.cancelEdit()
|
||||
this.$toasted.success(this.$t('languages.success'))
|
||||
})
|
||||
.catch((error) => {
|
||||
this.language = this.$store.state.language
|
||||
this.$toasted.error(error.message)
|
||||
})
|
||||
},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user