Migrate to TypeScript
This commit is contained in:
parent
83c1806d2b
commit
cfe419d41c
|
|
@ -153,7 +153,9 @@
|
||||||
"rules": {
|
"rules": {
|
||||||
"no-undef": 0,
|
"no-undef": 0,
|
||||||
"no-unused-vars": 0,
|
"no-unused-vars": 0,
|
||||||
"no-invalid-this": 0
|
"no-invalid-this": 0,
|
||||||
|
"indent": 0,
|
||||||
|
"@typescript-eslint/indent": [2, 2, { "SwitchCase": 1 }]
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
|
import Vue from 'vue'
|
||||||
import toastr from 'toastr'
|
import toastr from 'toastr'
|
||||||
import { swal } from '../../js/notify'
|
import { swal } from '../../js/notify'
|
||||||
|
|
||||||
export default {
|
export default Vue.extend<{
|
||||||
|
name: string,
|
||||||
|
tid: number
|
||||||
|
}, { addClosetItem(): Promise<void> }, {}>({
|
||||||
methods: {
|
methods: {
|
||||||
async addClosetItem() {
|
async addClosetItem() {
|
||||||
const { dismiss, value } = await swal({
|
const { dismiss, value } = await swal({
|
||||||
|
|
@ -10,7 +14,7 @@ export default {
|
||||||
inputValue: this.name,
|
inputValue: this.name,
|
||||||
input: 'text',
|
input: 'text',
|
||||||
showCancelButton: true,
|
showCancelButton: true,
|
||||||
inputValidator: val => !val && this.$t('skinlib.emptyItemName'),
|
inputValidator: val => (!val && this.$t('skinlib.emptyItemName')) || null,
|
||||||
})
|
})
|
||||||
if (dismiss) {
|
if (dismiss) {
|
||||||
return
|
return
|
||||||
|
|
@ -24,8 +28,8 @@ export default {
|
||||||
swal({ type: 'success', text: msg })
|
swal({ type: 'success', text: msg })
|
||||||
this.$emit('like-toggled', true)
|
this.$emit('like-toggled', true)
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(msg)
|
toastr.warning(msg!)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
|
|
@ -1,7 +1,11 @@
|
||||||
|
import Vue from 'vue'
|
||||||
import toastr from 'toastr'
|
import toastr from 'toastr'
|
||||||
import { swal } from '../../js/notify'
|
import { swal } from '../../js/notify'
|
||||||
|
|
||||||
export default {
|
export default Vue.extend<{
|
||||||
|
name: string,
|
||||||
|
tid: number
|
||||||
|
}, { removeClosetItem(): Promise<void> }, {}>({
|
||||||
methods: {
|
methods: {
|
||||||
async removeClosetItem() {
|
async removeClosetItem() {
|
||||||
const { dismiss } = await swal({
|
const { dismiss } = await swal({
|
||||||
|
|
@ -21,8 +25,8 @@ export default {
|
||||||
this.$emit('item-removed')
|
this.$emit('item-removed')
|
||||||
swal({ type: 'success', text: msg })
|
swal({ type: 'success', text: msg })
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(msg)
|
toastr.warning(msg!)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
|
|
@ -1,7 +1,10 @@
|
||||||
|
import Vue from 'vue'
|
||||||
import toastr from 'toastr'
|
import toastr from 'toastr'
|
||||||
import { swal } from '../../js/notify'
|
import { swal } from '../../js/notify'
|
||||||
|
|
||||||
export default {
|
export default Vue.extend<{
|
||||||
|
tid: number
|
||||||
|
}, { setAsAvatar(): Promise<void> }, {}>({
|
||||||
methods: {
|
methods: {
|
||||||
async setAsAvatar() {
|
async setAsAvatar() {
|
||||||
const { dismiss } = await swal({
|
const { dismiss } = await swal({
|
||||||
|
|
@ -19,13 +22,13 @@ export default {
|
||||||
{ tid: this.tid }
|
{ tid: this.tid }
|
||||||
)
|
)
|
||||||
if (errno === 0) {
|
if (errno === 0) {
|
||||||
toastr.success(msg)
|
toastr.success(msg!)
|
||||||
|
|
||||||
Array.from(document.querySelectorAll('[alt="User Image"]'))
|
Array.from(document.querySelectorAll<HTMLImageElement>('[alt="User Image"]'))
|
||||||
.forEach(el => (el.src += `?${new Date().getTime()}`))
|
.forEach(el => (el.src += `?${new Date().getTime()}`))
|
||||||
} else {
|
} else {
|
||||||
toastr.warning(msg)
|
toastr.warning(msg!)
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
}
|
})
|
||||||
Loading…
Reference in New Issue
Block a user