Skip to content

Commit ca31fcc

Browse files
committed
Swapped for clarity
The GET is the first request so should be the if not else
1 parent fbe0bbf commit ca31fcc

File tree

1 file changed

+6
-6
lines changed
  • packages/plugin-rsc/examples/navigation/src

1 file changed

+6
-6
lines changed

packages/plugin-rsc/examples/navigation/src/server.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ export default async function handler(request: Request): Promise<Response> {
66
let url: string;
77
let view: any;
88
const serverNavigator = new StateNavigator(stateNavigator);
9-
if (request.method === 'PUT') {
9+
if (request.method === 'GET') {
10+
let reqUrl = new URL(request.url);
11+
url = `${reqUrl.pathname}${reqUrl.search}`;
12+
const App = (await import('./App.tsx')).default;
13+
view = <App url={url} />;
14+
} else {
1015
const sceneViews: any = {
1116
people: await import('./People.tsx'),
1217
person: await import('./Person.tsx'),
@@ -27,11 +32,6 @@ export default async function handler(request: Request): Promise<Response> {
2732
const App = (await import('./App.tsx')).default;
2833
view = <App url={url} />;
2934
}
30-
} else {
31-
let reqUrl = new URL(request.url);
32-
url = `${reqUrl.pathname}${reqUrl.search}`;
33-
const App = (await import('./App.tsx')).default;
34-
view = <App url={url} />;
3535
}
3636
serverNavigator.navigateLink(url)
3737
const { NavigationHandler } = await import('navigation-react');

0 commit comments

Comments
 (0)