From 518e07d139e0040ab798211b72d9e70abfc3603d Mon Sep 17 00:00:00 2001 From: Hakadao Date: Sun, 26 Mar 2023 02:43:31 +0800 Subject: [PATCH] fix: fix some console errors when user is logout --- src/components/Button.vue | 9 ++++++++- src/components/Topbar/Topbar.vue | 1 + src/contentScripts/views/Anime/Anime.vue | 5 +++-- src/contentScripts/views/History/History.vue | 11 ++++++++++- 4 files changed, 22 insertions(+), 4 deletions(-) diff --git a/src/components/Button.vue b/src/components/Button.vue index bf7b2347..b04cdf3f 100644 --- a/src/components/Button.vue +++ b/src/components/Button.vue @@ -54,7 +54,8 @@ const handleClick = (evt: MouseEvent) => { --at-apply: bg-$b-color hover:bg-$b-color-hover rounded-$b-radius p-$b-padding transform-gpu active:scale-95 - duration-300 flex items-center gap-2 text-size-$b-font-size; + duration-300 flex items-center gap-2 text-size-$b-font-size + text-$b-text-color; & svg { --at-apply: text-size-$b-icon-size @@ -69,6 +70,12 @@ const handleClick = (evt: MouseEvent) => { &--type-default { } + &--type-primary { + --b-color: var(--bew-theme-color); + --b-color-hover: var(--bew-theme-color); + --b-text-color: white; + } + &--size-small { --b-padding: 6px 12px; --b-font-size: 14px; diff --git a/src/components/Topbar/Topbar.vue b/src/components/Topbar/Topbar.vue index 5ddca096..469167ad 100644 --- a/src/components/Topbar/Topbar.vue +++ b/src/components/Topbar/Topbar.vue @@ -153,6 +153,7 @@ function getNewMomentsCount() { .then((res) => { newMomentsCount.value = res.data.update_info.item.count }) + .catch(() => newMomentsCount.value = 0) } diff --git a/src/contentScripts/views/Anime/Anime.vue b/src/contentScripts/views/Anime/Anime.vue index 4089eaa0..52ac77ae 100644 --- a/src/contentScripts/views/Anime/Anime.vue +++ b/src/contentScripts/views/Anime/Anime.vue @@ -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() { --> -
+

{{ $t('anime.your_watch_list') }} diff --git a/src/contentScripts/views/History/History.vue b/src/contentScripts/views/History/History.vue index ddc355b4..33f795e2 100644 --- a/src/contentScripts/views/History/History.vue +++ b/src/contentScripts/views/History/History.vue @@ -234,10 +234,14 @@ function handleTurnOnWatchHistory() { if (result) setHistoryPauseStatus(false) } + +function jumpToLoginPage() { + location.href = 'https://passport.bilibili.com/login' +}