mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Implementing the updateUserInfos for language.
This commit is contained in:
parent
154b56ce57
commit
259b7547d4
@ -14,7 +14,7 @@
|
||||
<script>
|
||||
import { localeChanged } from 'vee-validate'
|
||||
import locales from '../locales/'
|
||||
import loginAPI from '../apis/loginAPI'
|
||||
import { updateUserInfos } from '../graphql/queries'
|
||||
|
||||
export default {
|
||||
name: 'LanguageSwitch',
|
||||
@ -34,16 +34,22 @@ export default {
|
||||
async saveLocale(locale) {
|
||||
this.setLocale(locale)
|
||||
if (this.$store.state.sessionId && this.$store.state.email) {
|
||||
const result = await loginAPI.updateLanguage(
|
||||
this.$store.state.sessionId,
|
||||
this.$store.state.email,
|
||||
locale,
|
||||
)
|
||||
if (result.success) {
|
||||
// toast success message
|
||||
} else {
|
||||
// toast error message
|
||||
}
|
||||
// eslint-disable-next-line no-console
|
||||
this.$apollo
|
||||
.query({
|
||||
query: updateUserInfos,
|
||||
variables: {
|
||||
sessionId: this.$store.state.sessionId,
|
||||
email: this.$store.state.email,
|
||||
locale: locale,
|
||||
},
|
||||
})
|
||||
.then((result) => {
|
||||
// toast success message
|
||||
})
|
||||
.catch(() => {
|
||||
// toast error message
|
||||
})
|
||||
}
|
||||
},
|
||||
getLocaleObject(code) {
|
||||
|
||||
@ -15,8 +15,52 @@ export const login = gql`
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export const logout = gql`
|
||||
query($sessionId: Float!) {
|
||||
logout(sessionId: $sessionId)
|
||||
}
|
||||
`
|
||||
|
||||
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) {
|
||||
sessionId
|
||||
email
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
export const updateUserInfos = gql`
|
||||
query(
|
||||
$sessionId: Float!
|
||||
$email: String!
|
||||
$firstName: String
|
||||
$lastName: String
|
||||
$description: String
|
||||
$username: String
|
||||
$password: String
|
||||
$passwordNew: String
|
||||
$locale: String
|
||||
) {
|
||||
updateUserInfos(
|
||||
sessionId: $sessionId
|
||||
email: $email
|
||||
firstName: $firstName
|
||||
lastName: $lastName
|
||||
description: $description
|
||||
username: $username
|
||||
password: $password
|
||||
passwordNew: $passwordNew
|
||||
language: $locale
|
||||
) {
|
||||
validValues
|
||||
}
|
||||
}
|
||||
`
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user