feat: function attribute typing
This commit is contained in:
@ -27,7 +27,7 @@ const route = useRoute()
|
||||
|
||||
async function deleteSavedFilter() {
|
||||
// We assume the listId in the route is the pseudolist
|
||||
const savedFilterId = getSavedFilterIdFromListId(route.params.listId)
|
||||
const savedFilterId = getSavedFilterIdFromListId(Number((route.params.listId as string)))
|
||||
|
||||
const filterService = new SavedFilterService()
|
||||
const filter = new SavedFilterModel({id: savedFilterId})
|
||||
|
@ -52,11 +52,12 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import {ref, shallowRef, computed, watch} from 'vue'
|
||||
import {ref, shallowRef, computed, watch, unref } from 'vue'
|
||||
import {useRouter, useRoute} from 'vue-router'
|
||||
import {store} from '@/store'
|
||||
import {success} from '@/message'
|
||||
import {success} from '@/message'
|
||||
import {useI18n} from 'vue-i18n'
|
||||
import type {MaybeRef} from '@vueuse/core'
|
||||
|
||||
import {default as Editor} from '@/components/input/AsyncEditor'
|
||||
import CreateEdit from '@/components/misc/create-edit.vue'
|
||||
@ -67,10 +68,11 @@ import SavedFilterService from '@/services/savedFilter'
|
||||
|
||||
import {objectToSnakeCase} from '@/helpers/case'
|
||||
import {getSavedFilterIdFromListId} from '@/helpers/savedFilter'
|
||||
import type ListModel from '@/models/list'
|
||||
|
||||
const {t} = useI18n({useScope: 'global'})
|
||||
|
||||
function useSavedFilter(listId) {
|
||||
function useSavedFilter(listId: MaybeRef<ListModel['id']>) {
|
||||
const filterService = shallowRef(new SavedFilterService())
|
||||
|
||||
const filter = ref(new SavedFilterModel())
|
||||
@ -82,9 +84,9 @@ function useSavedFilter(listId) {
|
||||
})
|
||||
|
||||
// loadSavedFilter
|
||||
watch(listId, async () => {
|
||||
watch(() => unref(listId), async () => {
|
||||
// We assume the listId in the route is the pseudolist
|
||||
const savedFilterId = getSavedFilterIdFromListId(route.params.listId)
|
||||
const savedFilterId = getSavedFilterIdFromListId(Number(route.params.listId as string))
|
||||
|
||||
filter.value = new SavedFilterModel({id: savedFilterId})
|
||||
const response = await filterService.value.get(filter.value)
|
||||
@ -110,7 +112,7 @@ function useSavedFilter(listId) {
|
||||
}
|
||||
|
||||
const route = useRoute()
|
||||
const listId = computed(() => route.params.listId)
|
||||
const listId = computed(() => Number(route.params.listId as string))
|
||||
|
||||
const {
|
||||
save,
|
||||
|
Reference in New Issue
Block a user