File tree Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Expand file tree Collapse file tree 2 files changed +5
-9
lines changed Original file line number Diff line number Diff line change @@ -314,10 +314,7 @@ const ExampleSelector: FC = () => {
314314 < DropdownMenuPortal >
315315 < DropdownMenuContent >
316316 { Object . entries ( examples ) . map ( ( [ slug , title ] ) => {
317- const params = new URLSearchParams ( ) ;
318- params . append ( "example" , slug ) ;
319-
320- const href = `${ window . location . origin } /parameters?${ params . toString ( ) } ` ;
317+ const href = `${ window . location . origin } /parameters/example/${ slug } ` ;
321318 return (
322319 < DropdownMenuItem key = { slug } asChild = { true } >
323320 < a href = { href } target = "_blank" rel = "noreferrer" >
Original file line number Diff line number Diff line change @@ -21,12 +21,11 @@ app.route("/api", api);
2121app . use ( trimTrailingSlash ( ) ) ;
2222
2323// Serves the main web application. This must come after the API route.
24- app . get ( "/parameters/:shareId?" , async ( c ) => {
24+ app . get ( "/parameters/:shareId?/:example? " , async ( c ) => {
2525 const getExampleCode = async ( ) : Promise < string | null > => {
26- const { shareId } = c . req . param ( ) ;
27- const { example } = c . req . query ( ) ;
26+ const { shareId, example } = c . req . param ( ) ;
2827
29- if ( shareId ) {
28+ if ( shareId && shareId !== "example" ) {
3029 const shareData = await getShareData ( shareId ) ;
3130 return shareData ?. code ?? null ;
3231 }
@@ -35,7 +34,7 @@ app.get("/parameters/:shareId?", async (c) => {
3534 return null ;
3635 }
3736
38- return examples [ example ] ;
37+ return examples [ example ] ?? null ;
3938 } ;
4039
4140 // Along with the vite React plugin this enables HMR within react while
You can’t perform that action at this time.
0 commit comments