Skip to content

Commit

Permalink
fix deep value not sync
Browse files Browse the repository at this point in the history
  • Loading branch information
tachibana-shin committed Apr 24, 2023
1 parent ccd473a commit e555298
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/pages/phim/_season.vue
Original file line number Diff line number Diff line change
Expand Up @@ -877,11 +877,16 @@ watchEffect(() => {
})
// TOOD: check chapName in url is chapName
watchEffect(() => {
if (!currentMetaChap.value) return
const chaps = currentDataSeason.value?.chaps
if (!chaps) return
const { chap: epId } = route.params
const metaEp = epId ? chaps.find((item) => item.id === epId) : chaps[0]
if (!metaEp) return
if (!route.params.chap) return // this first chap not need
const correctChapName = parseChapName(currentMetaChap.value.name)
const correctChapName = parseChapName(metaEp.name)
const urlChapName = route.params.chapName
if (urlChapName) {
Expand All @@ -892,7 +897,7 @@ watchEffect(() => {
`chapName wrong current: "${urlChapName}" not equal real: ${correctChapName}.\nAuto edit url to chapName correct`
)
router.replace({
path: `/phim/${route.params.season}/${correctChapName}-${route.params.chap}`,
path: `/phim/${route.params.season}/${correctChapName}-${epId}`,
query: route.query,
hash: route.hash,
})
Expand All @@ -901,7 +906,7 @@ watchEffect(() => {
// replace
console.info("this url old type redirect to new type url")
router.replace({
path: `/phim/${route.params.season}/${correctChapName}-${route.params.chap}`,
path: `/phim/${route.params.season}/${correctChapName}-${epId}`,
query: route.query,
hash: route.hash,
})
Expand Down

0 comments on commit e555298

Please sign in to comment.