Fix eslinter errors
Signed-off-by: Knut Ahlers <knut@ahlers.me>
This commit is contained in:
parent
1d6d2693fb
commit
5a3d93d9f7
2 changed files with 30 additions and 21 deletions
|
@ -4,16 +4,22 @@ module.exports = {
|
||||||
'root': true,
|
'root': true,
|
||||||
'parserOptions': {
|
'parserOptions': {
|
||||||
parser: 'babel-eslint',
|
parser: 'babel-eslint',
|
||||||
sourceType:'module',
|
sourceType: 'module',
|
||||||
},
|
},
|
||||||
'env': {
|
'env': {
|
||||||
node: true,
|
node: true,
|
||||||
},
|
},
|
||||||
'extends': [
|
'extends': [
|
||||||
|
/*
|
||||||
|
* https://github.com/vuejs/eslint-plugin-vue#priority-a-essential-error-prevention
|
||||||
|
* consider switching to `plugin:vue/strongly-recommended` or `plugin:vue/recommended` for stricter rules.
|
||||||
|
*/
|
||||||
|
'plugin:vue/essential',
|
||||||
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
|
// https://github.com/standard/standard/blob/master/docs/RULES-en.md
|
||||||
'eslint:recommended',
|
'eslint:recommended',
|
||||||
],
|
],
|
||||||
// required to lint *.vue files
|
// required to lint *.vue files
|
||||||
|
'plugins': ['vue'],
|
||||||
'globals': {
|
'globals': {
|
||||||
locale: true,
|
locale: true,
|
||||||
process: true,
|
process: true,
|
||||||
|
|
43
src/app.vue
43
src/app.vue
|
@ -113,7 +113,7 @@ export default {
|
||||||
error: '',
|
error: '',
|
||||||
mode: 'create',
|
mode: 'create',
|
||||||
secret: '',
|
secret: '',
|
||||||
securePassword:'',
|
securePassword: '',
|
||||||
secretId: '',
|
secretId: '',
|
||||||
showError: false,
|
showError: false,
|
||||||
}
|
}
|
||||||
|
@ -122,23 +122,24 @@ export default {
|
||||||
methods: {
|
methods: {
|
||||||
// createSecret executes the secret creation after encrypting the secret
|
// createSecret executes the secret creation after encrypting the secret
|
||||||
createSecret() {
|
createSecret() {
|
||||||
this.securePassword = Math.random().toString(36).substring(2)
|
this.securePassword = Math.random().toString(36)
|
||||||
|
.substring(2)
|
||||||
const secret = AES.enc(this.secret, this.securePassword)
|
const secret = AES.enc(this.secret, this.securePassword)
|
||||||
|
|
||||||
axios.post('api/create', { secret })
|
axios.post('api/create', { secret })
|
||||||
.then(resp=>{
|
.then(resp => {
|
||||||
this.secretId = resp.data.secret_id
|
this.secretId = resp.data.secret_id
|
||||||
this.secret = ''
|
this.secret = ''
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
switch (err.response.status) {
|
switch (err.response.status) {
|
||||||
case 404:
|
case 404:
|
||||||
// Mock for interface testing
|
// Mock for interface testing
|
||||||
this.secretId = 'foobar'
|
this.secretId = 'foobar'
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
this.error = this.$t('alert-something-went-wrong')
|
this.error = this.$t('alert-something-went-wrong')
|
||||||
this.showError = true
|
this.showError = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -148,10 +149,12 @@ export default {
|
||||||
// hashLoad reacts on a changed window hash an starts the diplaying of the secret
|
// hashLoad reacts on a changed window hash an starts the diplaying of the secret
|
||||||
hashLoad() {
|
hashLoad() {
|
||||||
const hash = window.location.hash
|
const hash = window.location.hash
|
||||||
if (hash.length === 0) return
|
if (hash.length === 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
const parts = hash.substring(1).split('|')
|
const parts = hash.substring(1).split('|')
|
||||||
if (parts.length == 2) {
|
if (parts.length === 2) {
|
||||||
this.securePassword = parts[1]
|
this.securePassword = parts[1]
|
||||||
}
|
}
|
||||||
this.secretId = parts[0]
|
this.secretId = parts[0]
|
||||||
|
@ -174,14 +177,14 @@ export default {
|
||||||
this.secret = secret
|
this.secret = secret
|
||||||
})
|
})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
switch(err.response.status) {
|
switch (err.response.status) {
|
||||||
case 404:
|
case 404:
|
||||||
this.error = this.$t('alert-secret-not-found')
|
this.error = this.$t('alert-secret-not-found')
|
||||||
this.showError = true
|
this.showError = true
|
||||||
break
|
break
|
||||||
default:
|
default:
|
||||||
this.error = this.$t('alert-something-went-wrong')
|
this.error = this.$t('alert-something-went-wrong')
|
||||||
this.showError = true
|
this.showError = true
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in a new issue