Skip to content

Commit

Permalink
128 phimseason not show screen error if use cache (#129)
Browse files Browse the repository at this point in the history
* fix not show screen error if exists cache

* no-spinner avatar

* if error cloudflare -> reload
  • Loading branch information
tachibana-shin authored Jun 13, 2023
1 parent 32f4a01 commit 7716d14
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
3 changes: 2 additions & 1 deletion src/components/errors/cloudflare.vue
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
no-caps
outline
rounded
@click="retry"
@click="reload"
style="color: #00be06"
>{{ t("thu-lai") }}</q-btn
>
Expand All @@ -53,6 +53,7 @@ const { t } = useI18n()
function openAnimeVietsub() {
window.open(C_URL)
}
const reload = () => location.reload()
</script>

<style></style>
1 change: 1 addition & 0 deletions src/layouts/MainLayout.vue
Original file line number Diff line number Diff line change
Expand Up @@ -624,6 +624,7 @@
<q-img-custom
v-if="authStore.user_data?.avatar"
:src="forceHttp2(authStore.user_data.avatar)"
no-spinner
referrerpolicy="no-referrer"
/>
<Icon
Expand Down
22 changes: 16 additions & 6 deletions src/pages/phim/_season.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
</div>

<div
v-if="loading && !data"
v-if="!error && loading && !data"
class="absolute w-full h-full overflow-hidden px-4 pt-6 text-[28px] row"
>
<div class="col-9 pr-4">
Expand Down Expand Up @@ -118,7 +118,7 @@
</div>
</div>

<div v-else-if="data" class="mx-4 row">
<div v-else-if="!error && data" class="mx-4 row">
<div class="col-9 pr-4">
<div class="flex-1 mt-4">
<h1
Expand Down Expand Up @@ -1223,40 +1223,50 @@ watch(
// eslint-disable-next-line functional/no-let
let typeCurrentConfig: keyof typeof servers | null = null
// eslint-disable-next-line functional/no-let
let loadedServerFB = false
// setup watcher it
const watcher = watch(
() => settingsStore.player.server,
async (server) => {
loadedServerFB = false
try {
if (server === "DU") {
if (typeCurrentConfig !== "DU")
// eslint-disable-next-line promise/catch-or-return
PlayerLink(currentMetaChap).then((conf) => {
// eslint-disable-next-line promise/always-return
if (settingsStore.player.server === "DU") {
configPlayer.value = conf
typeCurrentConfig = "DU"
}
})
.catch(err => {
error.value =err
})
}
if (server === "FB") {
// PlayerFB は常に PlayerLink よりも遅いため、DU を使用して高速プリロード戦術を使用する必要があります。
if (typeCurrentConfig !== "DU")
// eslint-disable-next-line promise/catch-or-return
PlayerLink(currentMetaChap).then((conf) => {
// eslint-disable-next-line promise/always-return
if (settingsStore.player.server === "DU") {
if (!loadedServerFB && settingsStore.player.server === "DU") {
configPlayer.value = conf
typeCurrentConfig = "DU"
}
})
// eslint-disable-next-line promise/catch-or-return
.catch(err => {
error.value =err
})
PlayerFB(currentMetaChap.id).then((conf) => {
// eslint-disable-next-line promise/always-return
if (settingsStore.player.server === "FB") {
configPlayer.value = conf
typeCurrentConfig = "FB"
}
loadedServerFB = true
})
.catch(err => {
error.value =err
})
}
} catch (err) {
Expand Down

0 comments on commit 7716d14

Please sign in to comment.