mirror of
https://github.com/iptv-org/iptv-org.github.io.git
synced 2025-05-13 10:30:05 -04:00
Update +page.server.js
This commit is contained in:
parent
46c3780592
commit
768357b9ef
1 changed files with 5 additions and 4 deletions
|
@ -1,3 +1,4 @@
|
||||||
|
import { error } from '@sveltejs/kit'
|
||||||
import { transformChannel } from '~/store'
|
import { transformChannel } from '~/store'
|
||||||
import _ from 'lodash'
|
import _ from 'lodash'
|
||||||
import channels from '~/data/channels.json'
|
import channels from '~/data/channels.json'
|
||||||
|
@ -35,12 +36,12 @@ export function load({ params }) {
|
||||||
const name = params.name
|
const name = params.name
|
||||||
const id = `${name}.${country}`.toLowerCase()
|
const id = `${name}.${country}`.toLowerCase()
|
||||||
|
|
||||||
let channel = data.channels[id] || {}
|
let channel = data.channels[id]
|
||||||
if (channel) {
|
if (!channel) {
|
||||||
channel = transformChannel(channel, data)
|
throw error(404, 'Not Found')
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
channel
|
channel: transformChannel(channel, data)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue