Skip to content

Commit

Permalink
fix(routes): redirect / => /en-US/ except for writers (#10778)
Browse files Browse the repository at this point in the history
Previously, http://localhost:3000/ showed an incomplete homepage,
except for writers (WRITER_MODE=true) who see the writer's homepage.

Now, we redirect to /en-US/ for developers, to avoid confusion.
  • Loading branch information
caugner committed Mar 25, 2024
1 parent 40be4dd commit 7d694d0
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions client/src/app.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
import React, { useEffect } from "react";
import { Routes, Route, useLocation, useMatch } from "react-router-dom";
import {
Navigate,
Routes,
Route,
useLocation,
useMatch,
} from "react-router-dom";

// we include our base SASS here to ensure it is loaded
// and applied before any component specific style
Expand Down Expand Up @@ -161,10 +167,13 @@ export function App(appProps: HydrationData) {
{/*
Note, this can only happen in local development.
In production, all traffic at `/` is redirected to at least
having a locale. So it'll be `/en-US` (for example) by the
having a locale. So it'll be `/en-US/` (for example) by the
time it hits any React code.
*/}
<Route path="/" element={homePage} />
<Route
path="/"
element={WRITER_MODE ? homePage : <Navigate to="/en-US/" />}
/>
<Route
path="/en-US/curriculum/*"
element={
Expand Down

0 comments on commit 7d694d0

Please sign in to comment.