fix: resolve build type errors in gallery pagination
Remove unused nextTick import, fix generic type assertion on supabase.from select options, and add double type cast for query result mapping.
This commit is contained in:
@@ -1,5 +1,5 @@
|
|||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import { computed, nextTick, onMounted, onUnmounted, ref, watch } from 'vue'
|
import { computed, onMounted, onUnmounted, ref, watch } from 'vue'
|
||||||
import { NAlert, NButton, NDropdown, NEmpty, NIcon, NSkeleton, NTag, useMessage } from 'naive-ui'
|
import { NAlert, NButton, NDropdown, NEmpty, NIcon, NSkeleton, NTag, useMessage } from 'naive-ui'
|
||||||
import { Clock, Location, Search, Settings, User, X } from '@vicons/tabler'
|
import { Clock, Location, Search, Settings, User, X } from '@vicons/tabler'
|
||||||
import CloudEditModal, { type CloudEditFormValue } from '@/components/cloud/CloudEditModal.vue'
|
import CloudEditModal, { type CloudEditFormValue } from '@/components/cloud/CloudEditModal.vue'
|
||||||
@@ -166,7 +166,7 @@ const FULL_SELECT = 'id,user_id,cloud_type_id,image_url,thumbnail_url,location_n
|
|||||||
function buildFilteredQuery(selectStr: string, options?: { count?: 'exact'; head?: boolean }) {
|
function buildFilteredQuery(selectStr: string, options?: { count?: 'exact'; head?: boolean }) {
|
||||||
let query = supabase
|
let query = supabase
|
||||||
.from('clouds')
|
.from('clouds')
|
||||||
.select(selectStr, options as Parameters<typeof supabase.from<'clouds'>['select']>[1])
|
.select(selectStr, options as any)
|
||||||
.eq('status', 'approved')
|
.eq('status', 'approved')
|
||||||
.eq('is_hidden', false)
|
.eq('is_hidden', false)
|
||||||
|
|
||||||
@@ -215,7 +215,7 @@ async function loadPage(page: number) {
|
|||||||
if (error) throw error
|
if (error) throw error
|
||||||
|
|
||||||
totalCount.value = count ?? 0
|
totalCount.value = count ?? 0
|
||||||
galleryItems.value = ((data || []) as Array<Record<string, unknown>>).map(toGalleryCloud)
|
galleryItems.value = ((data || []) as unknown as Array<Record<string, unknown>>).map(toGalleryCloud)
|
||||||
currentPage.value = page
|
currentPage.value = page
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
loadError.value = error instanceof Error ? error.message : '画廊加载失败'
|
loadError.value = error instanceof Error ? error.message : '画廊加载失败'
|
||||||
|
|||||||
Reference in New Issue
Block a user