Skip to content

armgit / jan

Public Imported from GitHub
0

Jan is an open source alternative to ChatGPT that runs 100% offline on your computer.

527 B
Raw Blame
import { redirect } from '@tanstack/react-router'
import { route } from '@/constants/routes'
import { isCoworkEnabled } from '@/lib/version'

/**
 * `beforeLoad` guard for every Cowork URL. On a build that does not ship
 * Cowork, a bookmarked `/cowork`, `/artifacts` or `/settings/cowork` link lands
 * on `fallback` instead of mounting a surface that has no entry point left.
 */
export function ensureCoworkEnabled(fallback: string = route.home) {
  if (!isCoworkEnabled()) throw redirect({ to: fallback, replace: true })
}