1
0

feat: type improvements

This commit is contained in:
Dominik Pschenitschni
2022-10-17 13:14:07 +02:00
parent 1002579173
commit 599e28e5e5
43 changed files with 162 additions and 135 deletions

View File

@ -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)

View File

@ -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},

View File

@ -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)

View File

@ -558,7 +558,7 @@ const canWrite = computed(() => (
const color = computed(() => {
const color = task.getHexColor
? task.getHexColor()
: false
: undefined
return color === TASK_DEFAULT_COLOR
? ''

View File

@ -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
}

View File

@ -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>

View File

@ -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>

View File

@ -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
},

View File

@ -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('')