Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix not_found if change ss #114

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions src/pages/phim/_season.vue
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ import { AjaxRate } from "src/apis/runs/ajax/rate"
import { PhimId } from "src/apis/runs/phim/[id]"
import { PhimIdChap } from "src/apis/runs/phim/[id]/[chap]"
// import BottomSheet from "src/components/BottomSheet.vue"
import type { servers } from "src/constants";
import type { servers } from "src/constants"
import { C_URL, TIMEOUT_GET_LAST_EP_VIEWING_IN_STORE } from "src/constants"
import { forceHttp2 } from "src/logic/forceHttp2"
import { formatView } from "src/logic/formatView"
Expand Down Expand Up @@ -849,6 +849,8 @@ watchEffect(() => {
) {
const correctChapName = parseChapName(currentMetaChap.value.name)

if (import.meta.env.DEV)
console.log("%c Redirect to suspend path", "color: green")
router.replace({
path: `/phim/${route.params.season}/${correctChapName}-${currentChap.value}`,
query: route.query,
Expand All @@ -858,11 +860,13 @@ watchEffect(() => {
})
watchEffect(() => {
// currentChap != undefined because is load done from firestore and ready show but in chaps not found (!currentMetaChap.value)
if (
currentDataSeason.value?.chaps &&
currentChap.value &&
!currentMetaChap.value
) {
const chaps = currentDataSeason.value?.chaps
if (!chaps) return

const { chap: epId } = route.params

if (!chaps.some((item) => item.id === epId)) {
if (import.meta.env.DEV) console.warn("Redirect to not_found")
router.replace({
name: "not_found",
params: {
Expand All @@ -879,7 +883,7 @@ watchEffect(() => {
if (!chaps) return

const { chap: epId } = route.params

const metaEp = epId ? chaps.find((item) => item.id === epId) : chaps[0]
if (!metaEp) return

Expand Down