File tree Expand file tree Collapse file tree 3 files changed +33
-0
lines changed
Expand file tree Collapse file tree 3 files changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ import { LoaderFunctionArgs } from '@remix-run/node' ;
2+ import { redirect } from '@remix-run/react' ;
3+
4+ export const loader = ( args : LoaderFunctionArgs ) => {
5+ return redirect ( `/build/${ encodeURIComponent ( args . params . id ! ) } ` ) ;
6+ } ;
Original file line number Diff line number Diff line change 1+ import { LoaderFunctionArgs } from '@remix-run/node' ;
2+ import { redirect } from '@remix-run/react' ;
3+
4+ const channelsMap : Record < string , string | undefined > = {
5+ stable : 'stable' ,
6+ prerelease : 'pre' ,
7+ nightly : 'nightly' ,
8+ } ;
9+
10+ export const loader = ( args : LoaderFunctionArgs ) => {
11+ let channel = channelsMap [ args . params . channel || 'stable' ] ;
12+ if ( ! channel ) {
13+ channel = 'stable' ;
14+ }
15+ return redirect ( `/release?channel=${ encodeURIComponent ( channel ) } ` ) ;
16+ } ;
Original file line number Diff line number Diff line change 11import { type RouteConfig , index , route } from '@remix-run/route-config' ;
22
3+ const redirect = ( path : string , file : string ) => {
4+ return {
5+ ...route ( path , file ) ,
6+ id : path ,
7+ } ;
8+ } ;
9+
310export default [
411 // Home page
512 index ( 'routes/home.tsx' ) ,
613 // API routes
714 route ( 'releases.json' , 'api/releases.ts' ) ,
815 route ( 'active.json' , 'api/active.ts' ) ,
16+ // Redirects
17+ redirect ( 'releases' , 'redirects/releases.tsx' ) ,
18+ redirect ( 'releases/:channel' , 'redirects/releases.tsx' ) ,
19+ redirect ( 'release-build/:id' , 'redirects/release-build.tsx' ) ,
920 // UI routes
1021 route ( 'build/:id' , 'routes/build/release-job.tsx' ) ,
1122 route ( 'history' , 'routes/history.tsx' ) ,
You can’t perform that action at this time.
0 commit comments