cleaned frontend

This commit is contained in:
Ulf Gebhardt 2022-02-07 05:20:40 +01:00
parent 817e462698
commit 148bd6286c
Signed by: ulfgebhardt
GPG Key ID: DA6B843E748679C9
7 changed files with 7 additions and 70 deletions

View File

@ -22,8 +22,6 @@ export const updateUserInfos = gql`
mutation(
$firstName: String
$lastName: String
$description: String
$username: String
$password: String
$passwordNew: String
$locale: String
@ -32,8 +30,6 @@ export const updateUserInfos = gql`
updateUserInfos(
firstName: $firstName
lastName: $lastName
description: $description
username: $username
password: $password
passwordNew: $passwordNew
language: $locale

View File

@ -4,11 +4,9 @@ export const login = gql`
query($email: String!, $password: String!, $publisherId: Int) {
login(email: $email, password: $password, publisherId: $publisherId) {
email
username
firstName
lastName
language
description
coinanimation
klickTipp {
newsletterState
@ -24,11 +22,9 @@ export const verifyLogin = gql`
query {
verifyLogin {
email
username
firstName
lastName
language
description
coinanimation
klickTipp {
newsletterState
@ -93,12 +89,6 @@ export const sendResetPasswordEmail = gql`
}
`
export const checkUsername = gql`
query($username: String!) {
checkUsername(username: $username)
}
`
export const listGDTEntriesQuery = gql`
query($currentPage: Int!, $pageSize: Int!) {
listGDTEntries(currentPage: $currentPage, pageSize: $pageSize) {

View File

@ -15,18 +15,15 @@ export const mutations = {
email: (state, email) => {
state.email = email
},
username: (state, username) => {
state.username = username
},
// username: (state, username) => {
// state.username = username
// },
firstName: (state, firstName) => {
state.firstName = firstName
},
lastName: (state, lastName) => {
state.lastName = lastName
},
description: (state, description) => {
state.description = description
},
token: (state, token) => {
state.token = token
},
@ -56,10 +53,9 @@ export const actions = {
login: ({ dispatch, commit }, data) => {
commit('email', data.email)
commit('language', data.language)
commit('username', data.username)
// commit('username', data.username)
commit('firstName', data.firstName)
commit('lastName', data.lastName)
commit('description', data.description)
commit('coinanimation', data.coinanimation)
commit('newsletterState', data.klickTipp.newsletterState)
commit('hasElopage', data.hasElopage)
@ -69,10 +65,9 @@ export const actions = {
logout: ({ commit, state }) => {
commit('token', null)
commit('email', null)
commit('username', '')
// commit('username', '')
commit('firstName', '')
commit('lastName', '')
commit('description', '')
commit('coinanimation', true)
commit('newsletterState', null)
commit('hasElopage', false)
@ -96,8 +91,7 @@ try {
language: null,
firstName: '',
lastName: '',
username: '',
description: '',
// username: '',
token: null,
isAdmin: false,
coinanimation: true,

View File

@ -1,7 +1,6 @@
import { configure, extend } from 'vee-validate'
// eslint-disable-next-line camelcase
import { required, email, min, max, is_not } from 'vee-validate/dist/rules'
import { checkUsername } from './graphql/queries'
export const loadAllRules = (i18nCallback) => {
configure({
@ -49,32 +48,6 @@ export const loadAllRules = (i18nCallback) => {
},
})
extend('gddUsernameUnique', {
async validate(value) {
this.$apollo
.query({
query: checkUsername,
variables: {
username: value,
},
})
.then((result) => {
return result.data.checkUsername
})
.catch(() => {
return false
})
},
message: (_, values) => i18nCallback.t('form.validation.usernmae-unique', values),
})
extend('gddUsernameRgex', {
validate(value) {
return !!value.match(/^[a-zA-Z][-_a-zA-Z0-9]{2,}$/)
},
message: (_, values) => i18nCallback.t('form.validation.usernmae-regex', values),
})
// eslint-disable-next-line camelcase
extend('is_not', {
// eslint-disable-next-line camelcase

View File

@ -43,17 +43,6 @@
<b-input type="text" v-model="form.lastName"></b-input>
</b-col>
</b-row>
<b-row class="mb-3" v-show="false">
<b-col class="col-12">
<small>{{ $t('form.description') }}</small>
</b-col>
<b-col v-if="showUserData" class="col-12">
{{ form.description }}
</b-col>
<b-col v-else class="col-12">
<b-textarea rows="3" max-rows="6" v-model="form.description"></b-textarea>
</b-col>
</b-row>
<b-row class="text-right" v-if="!showUserData">
<b-col>
@ -85,7 +74,6 @@ export default {
form: {
firstName: this.$store.state.firstName,
lastName: this.$store.state.lastName,
description: this.$store.state.description,
},
loading: true,
}
@ -94,14 +82,12 @@ export default {
cancelEdit() {
this.form.firstName = this.$store.state.firstName
this.form.lastName = this.$store.state.lastName
this.form.description = this.$store.state.description
this.showUserData = true
},
loadSubmitButton() {
if (
this.form.firstName !== this.$store.state.firstName ||
this.form.lastName !== this.$store.state.lastName ||
this.form.description !== this.$store.state.description
this.form.lastName !== this.$store.state.lastName
) {
this.loading = false
} else {
@ -116,13 +102,11 @@ export default {
variables: {
firstName: this.form.firstName,
lastName: this.form.lastName,
description: this.form.description,
},
})
.then(() => {
this.$store.commit('firstName', this.form.firstName)
this.$store.commit('lastName', this.form.lastName)
this.$store.commit('description', this.form.description)
this.showUserData = true
this.$toasted.success(this.$t('settings.name.change-success'))
})