UNPKG

317 BPlain TextView Raw
1import { getURL } from '../getURL'
2import { router } from '../imperative-api'
3
4export const redirect = (path: string, status?: number) => {
5 if (process.env.VITE_ENVIRONMENT === 'client') {
6 router.navigate(path)
7 return
8 }
9
10 return Response.redirect(path[0] === '/' ? `${getURL()}${path}` : path, status)
11}