diff --git a/examples/preact/authenticated-routes/index.html b/examples/preact/authenticated-routes/index.html new file mode 100644 index 00000000000..5c7fd8a77e9 --- /dev/null +++ b/examples/preact/authenticated-routes/index.html @@ -0,0 +1,12 @@ + + +
+ + +Hi {auth.user}!
+You are currently on the dashboard route.
++ Invoice title: {invoice.title} +
++ Invoice body: {invoice.body} +
+Choose an invoice from the list below.
+This route's content is only visible to authenticated users.
+
+ IMPORTANT!!! This is just an
+ example of how to use authenticated routes with TanStack Router.
+
+ This is NOT an example how you'd write a production-level authentication
+ system.
+
+ You'll need to take the concepts and patterns used in this example and
+ adapt then to work with your authentication flow/system for your app.
+
+ You are currently on the index route of the{' '} + authenticated-routes example. +
+You can try going through these options.
+You need to login to access this page.
+ ) : ( +Login to see all the cool content in here.
+ )} + +This is the notFoundComponent configured on root route
+ Start Over +Post not found
+ }, + component: PostComponent, +}) + +export function PostErrorComponent({ error }: ErrorComponentProps) { + returnThis is the notFoundComponent configured on root route
+ Start Over +This is the notFoundComponent configured on root route
+ Start Over +This is the notFoundComponent configured on root route
+ Start Over +This is a public page. Anyone can access it.
+ ${ + user + ? ` +You are logged in as ${user.username}.
+ Go to Dashboard + ` + : ` +You are not logged in.
+ Login + ` + } +
+ Demo credentials:
+ Username: admin
+ Password: password
+
Welcome, ${user?.username}!
+This is a protected route. Only authenticated users can access it.
+If you try to access this page while logged out, you'll be redirected to the login page.
+ +This is the notFoundComponent configured on root route
+ Start Over +
+
+# TanStack React Router
+
+
+
+🤖 Type-safe router w/ built-in caching & URL state management for React!
+
+
+
+ {error.message ? {error.message} : null}
+
+