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. 16
      app/pages/me/media/index.vue

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

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

Loading…
Cancel
Save