feat: improved types (#2547)
Reviewed-on: https://kolaente.dev/vikunja/frontend/pulls/2547 Reviewed-by: konrad <k@knt.li>
This commit is contained in:
@ -14,7 +14,6 @@
|
||||
</router-link>
|
||||
</message>
|
||||
<add-task
|
||||
:listId="defaultListId"
|
||||
@taskAdded="updateTaskList"
|
||||
class="is-max-width-desktop"
|
||||
/>
|
||||
@ -76,6 +75,7 @@ import {useConfigStore} from '@/stores/config'
|
||||
import {useNamespaceStore} from '@/stores/namespaces'
|
||||
import {useAuthStore} from '@/stores/auth'
|
||||
import {useTaskStore} from '@/stores/tasks'
|
||||
import type {IList} from '@/modelTypes/IList'
|
||||
|
||||
const salutation = useDaytimeSalutation()
|
||||
|
||||
@ -94,12 +94,11 @@ const listHistory = computed(() => {
|
||||
|
||||
return getHistory()
|
||||
.map(l => listStore.getListById(l.id))
|
||||
.filter(l => l !== null)
|
||||
.filter((l): l is IList => l !== null)
|
||||
})
|
||||
|
||||
const migratorsEnabled = computed(() => configStore.availableMigrators?.length > 0)
|
||||
const hasTasks = computed(() => baseStore.hasTasks)
|
||||
const defaultListId = computed(() => authStore.settings.defaultListId)
|
||||
const defaultNamespaceId = computed(() => namespaceStore.namespaces?.[0]?.id || 0)
|
||||
const hasLists = computed(() => namespaceStore.namespaces?.[0]?.lists.length > 0)
|
||||
const loading = computed(() => taskStore.isLoading)
|
||||
|
@ -66,7 +66,7 @@ async function newLabel() {
|
||||
showError.value = false
|
||||
|
||||
const labelStore = useLabelStore()
|
||||
const newLabel = labelStore.createLabel(label.value)
|
||||
const newLabel = await labelStore.createLabel(label.value)
|
||||
router.push({
|
||||
name: 'labels.index',
|
||||
params: {id: newLabel.id},
|
||||
|
@ -71,11 +71,13 @@ import {useI18n} from 'vue-i18n'
|
||||
import {useTitle} from '@/composables/useTitle'
|
||||
import {useNamespaceStore} from '@/stores/namespaces'
|
||||
|
||||
import type {INamespace} from '@/modelTypes/INamespace'
|
||||
|
||||
const {t} = useI18n({useScope: 'global'})
|
||||
const namespaceStore = useNamespaceStore()
|
||||
|
||||
const namespaceService = ref(new NamespaceService())
|
||||
const namespace = ref(new NamespaceModel())
|
||||
const namespace = ref<INamespace>(new NamespaceModel())
|
||||
const editorActive = ref(false)
|
||||
const title = ref('')
|
||||
useTitle(() => title.value)
|
||||
|
@ -558,7 +558,7 @@ const canWrite = computed(() => (
|
||||
const color = computed(() => {
|
||||
const color = task.getHexColor
|
||||
? task.getHexColor()
|
||||
: false
|
||||
: undefined
|
||||
|
||||
return color === TASK_DEFAULT_COLOR
|
||||
? ''
|
||||
|
@ -50,14 +50,14 @@ async function authenticateWithCode() {
|
||||
if (localStorage.getItem('authenticating')) {
|
||||
return
|
||||
}
|
||||
localStorage.setItem('authenticating', true)
|
||||
localStorage.setItem('authenticating', 'true')
|
||||
|
||||
errorMessage.value = ''
|
||||
|
||||
if (typeof route.query.error !== 'undefined') {
|
||||
localStorage.removeItem('authenticating')
|
||||
errorMessage.value = typeof route.query.message !== 'undefined'
|
||||
? route.query.message
|
||||
? route.query.message as string
|
||||
: t('user.auth.openIdGeneralError')
|
||||
return
|
||||
}
|
||||
|
@ -130,8 +130,8 @@ async function submit() {
|
||||
|
||||
try {
|
||||
await authStore.register(toRaw(credentials))
|
||||
} catch (e) {
|
||||
errorMessage.value = e.message
|
||||
} catch (e: any) {
|
||||
errorMessage.value = e?.message
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
@ -23,7 +23,7 @@
|
||||
<x-button
|
||||
v-if="!isCropAvatar"
|
||||
:loading="avatarService.loading || loading"
|
||||
@click="$refs.avatarUploadInput.click()"
|
||||
@click="avatarUploadInput.click()"
|
||||
>
|
||||
{{ $t('user.settings.avatar.uploadAvatar') }}
|
||||
</x-button>
|
||||
|
@ -41,7 +41,7 @@
|
||||
<td>{{ tk.id }}</td>
|
||||
<td>{{ formatDateShort(tk.created) }}</td>
|
||||
<td class="has-text-right">
|
||||
<x-button type="secondary" @click="deleteToken(tk)">
|
||||
<x-button variant="secondary" @click="deleteToken(tk)">
|
||||
{{ $t('misc.delete') }}
|
||||
</x-button>
|
||||
</td>
|
||||
|
@ -246,7 +246,7 @@ watch(
|
||||
|
||||
const listStore = useListStore()
|
||||
const defaultList = computed({
|
||||
get: () => listStore.getListById(settings.value.defaultListId),
|
||||
get: () => listStore.getListById(settings.value.defaultListId) || undefined,
|
||||
set(l) {
|
||||
settings.value.defaultListId = l ? l.id : DEFAULT_LIST_ID
|
||||
},
|
||||
|
@ -79,13 +79,14 @@ import {success} from '@/message'
|
||||
|
||||
import {useTitle} from '@/composables/useTitle'
|
||||
import {useConfigStore} from '@/stores/config'
|
||||
import type {ITotp} from '@/modelTypes/ITotp'
|
||||
|
||||
const {t} = useI18n({useScope: 'global'})
|
||||
useTitle(() => `${t('user.settings.totp.title')} - ${t('user.settings.title')}`)
|
||||
|
||||
|
||||
const totpService = shallowReactive(new TotpService())
|
||||
const totp = ref(new TotpModel())
|
||||
const totp = ref<ITotp>(new TotpModel())
|
||||
const totpQR = ref('')
|
||||
const totpEnrolled = ref(false)
|
||||
const totpConfirmPasscode = ref('')
|
||||
|
Reference in New Issue
Block a user