Browse Source

fix(media): load library on client after auth refresh (avoid SSR 401)

Made-with: Cursor
tags/邮箱功能前置
npmrun 3 weeks ago
parent
commit
2cc931b929
  1. 18
      app/pages/me/media/index.vue

18
app/pages/me/media/index.vue

@ -1,4 +1,6 @@
<script setup lang="ts"> <script setup lang="ts">
import { useAuthSession } from '../../../composables/useAuthSession'
definePageMeta({ title: '媒体库' }) definePageMeta({ title: '媒体库' })
type MediaAssetRow = { type MediaAssetRow = {
@ -12,6 +14,7 @@ type MediaAssetRow = {
} }
const toast = useToast() const toast = useToast()
const { refresh: refreshAuth } = useAuthSession()
const { fetchData, getApiErrorMessage } = useClientApi() const { fetchData, getApiErrorMessage } = useClientApi()
const page = ref(1) const page = ref(1)
@ -70,13 +73,14 @@ watch(pageSize, () => {
page.value = 1 page.value = 1
}) })
watch( watch([page, pageSize], () => {
[page, pageSize], void load()
() => { })
void load()
}, onMounted(() => {
{ immediate: true }, void refreshAuth(true)
) void load()
})
function openFilePicker() { function openFilePicker() {
fileInput.value?.click() fileInput.value?.click()

Loading…
Cancel
Save