Update client/web-sveltekit/src/routes/[...repo=reporev]/-/commit/[...revspec]/+page.ts

Co-authored-by: Camden Cheek <camden@ccheek.com>
This commit is contained in:
Jason Hawk Harris 2024-08-12 13:30:59 -05:00 committed by Jason Harris
parent 10e69021d0
commit 2f2e464296

View File

@ -19,13 +19,11 @@ export const load: PageLoad = async ({ url, params }) => {
}
const commit = result.data?.repository?.commit
const isPerforceDepot = commit?.perforceChangelist !== null
if (!commit) {
error(404, 'Commit not found')
}
if (isPerforceDepot) {
if (commit.perforceChangelist !== null) {
const redirectURL = new URL(url)
redirectURL.pathname = `${params.repo}/-/changelist/${commit.perforceChangelist?.cid}`
redirect(301, redirectURL)