mirror of
https://github.com/IT4Change/gradido.git
synced 2025-12-13 07:45:54 +00:00
Withdrew the loginAPI call and changed it with the new apollo query call.
This commit is contained in:
parent
dc256719c1
commit
e6ffd08db9
@ -68,6 +68,7 @@
|
||||
</template>
|
||||
<script>
|
||||
import loginAPI from '../../../apis/loginAPI'
|
||||
import { updateUserInfos } from '../../../graphql/queries'
|
||||
|
||||
export default {
|
||||
name: 'FormUsername',
|
||||
@ -86,22 +87,27 @@ export default {
|
||||
this.showUsername = true
|
||||
},
|
||||
async onSubmit() {
|
||||
const result = await loginAPI.changeUsernameProfile(
|
||||
this.$store.state.sessionId,
|
||||
this.$store.state.email,
|
||||
this.form.username,
|
||||
)
|
||||
if (result.success) {
|
||||
this.$store.commit('username', this.form.username)
|
||||
this.username = this.form.username
|
||||
this.showUsername = true
|
||||
this.$toasted.success(this.$t('site.profil.user-data.change-success'))
|
||||
} else {
|
||||
this.$toasted.error(result.result.message)
|
||||
this.showUsername = true
|
||||
this.username = this.$store.state.username
|
||||
this.form.username = this.$store.state.username
|
||||
}
|
||||
this.$apollo
|
||||
.query({
|
||||
query: updateUserInfos,
|
||||
variables: {
|
||||
sessionId: this.$store.state.sessionId,
|
||||
email: this.$store.state.email,
|
||||
username: this.form.username,
|
||||
},
|
||||
})
|
||||
.then(() => {
|
||||
this.$store.commit('username', this.form.username)
|
||||
this.username = this.form.username
|
||||
this.showUsername = true
|
||||
this.$toasted.success(this.$t('site.profil.user-data.change-success'))
|
||||
})
|
||||
.catch((error) => {
|
||||
this.$toasted.error(error.message)
|
||||
this.showUsername = true
|
||||
this.username = this.$store.state.username
|
||||
this.form.username = this.$store.state.username
|
||||
})
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user