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( mutation(
$firstName: String $firstName: String
$lastName: String $lastName: String
$description: String
$username: String
$password: String $password: String
$passwordNew: String $passwordNew: String
$locale: String $locale: String
@ -32,8 +30,6 @@ export const updateUserInfos = gql`
updateUserInfos( updateUserInfos(
firstName: $firstName firstName: $firstName
lastName: $lastName lastName: $lastName
description: $description
username: $username
password: $password password: $password
passwordNew: $passwordNew passwordNew: $passwordNew
language: $locale language: $locale

View File

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

View File

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

View File

@ -1,7 +1,6 @@
import { configure, extend } from 'vee-validate' import { configure, extend } from 'vee-validate'
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase
import { required, email, min, max, is_not } from 'vee-validate/dist/rules' import { required, email, min, max, is_not } from 'vee-validate/dist/rules'
import { checkUsername } from './graphql/queries'
export const loadAllRules = (i18nCallback) => { export const loadAllRules = (i18nCallback) => {
configure({ 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 // eslint-disable-next-line camelcase
extend('is_not', { extend('is_not', {
// eslint-disable-next-line camelcase // eslint-disable-next-line camelcase

View File

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