fix: fix some console errors when user is logout

This commit is contained in:
Hakadao
2023-03-26 02:43:31 +08:00
parent 3460329c22
commit 518e07d139
4 changed files with 22 additions and 4 deletions

View File

@@ -53,6 +53,7 @@ function getAnimeWatchList() {
if (code === 0)
Object.assign(animeWatchList, list as AnimeItem[])
})
.catch(() => Object.assign(animeWatchList, []))
.finally(() => {
isLoading.value = false
})
@@ -77,7 +78,7 @@ function getRecommendAnimeList() {
coursor.value = coursor
}
})
}).catch(() => coursor.value = 29)
.finally(() => {
isLoading.value = false
})
@@ -107,7 +108,7 @@ function getPopularAnimeList() {
</section> -->
<!-- Your Watchlist -->
<section mb-8>
<section v-if="getUserID()" mb-8>
<div flex justify-between items-end mb-6>
<h3 text="3xl $bew-text-1" font="bold">
{{ $t('anime.your_watch_list') }}

View File

@@ -234,10 +234,14 @@ function handleTurnOnWatchHistory() {
if (result)
setHistoryPauseStatus(false)
}
function jumpToLoginPage() {
location.href = 'https://passport.bilibili.com/login'
}
</script>
<template>
<div flex="~ col md:row lg:row" gap-4>
<div v-if="getCSRF()" flex="~ col md:row lg:row" gap-4>
<main w="full md:60% lg:70% xl:75%" order="2 md:1 lg:1" mb-6>
<h3 text="3xl $bew-text-1" font-bold mb-6>
{{ $t('history.title') }}
@@ -516,6 +520,11 @@ function handleTurnOnWatchHistory() {
</div>
</aside>
</div>
<Empty v-else mt-6 description="Please login first">
<Button type="primary" @click="jumpToLoginPage()">
Login
</Button>
</Empty>
</template>
<style lang="scss" scoped>