File tree Expand file tree Collapse file tree 4 files changed +44
-8
lines changed
Expand file tree Collapse file tree 4 files changed +44
-8
lines changed Original file line number Diff line number Diff line change 11"""Welcome to Reflex! This file outlines the steps to create a basic app."""
22
33import reflex as rx
4+ import reflex_local_auth
45
56from rxconfig import config
67from .ui .base import base_page
@@ -46,6 +47,19 @@ def index() -> rx.Component:
4647
4748app = rx .App ()
4849app .add_page (index )
50+ # reflex_local_auth pages
51+ app .add_page (
52+ reflex_local_auth .pages .login_page ,
53+ route = reflex_local_auth .routes .LOGIN_ROUTE ,
54+ title = "Login" ,
55+ )
56+ app .add_page (
57+ reflex_local_auth .pages .register_page ,
58+ route = reflex_local_auth .routes .REGISTER_ROUTE ,
59+ title = "Register" ,
60+ )
61+
62+ # my pages
4963app .add_page (pages .about_page ,
5064 route = navigation .routes .ABOUT_US_ROUTE )
5165
Original file line number Diff line number Diff line change 11import reflex as rx
2-
2+ import reflex_local_auth
33from . import routes
44
55class NavState (rx .State ):
66 def to_home (self ):
77 return rx .redirect (routes .HOME_ROUTE )
8+
9+ def to_register (self ):
10+ return rx .redirect (reflex_local_auth .routes .REGISTER_ROUTE )
11+
12+ def to_login (self ):
13+ return rx .redirect (reflex_local_auth .routes .LOGIN_ROUTE )
14+
815 def to_about_us (self ):
916 return rx .redirect (routes .ABOUT_US_ROUTE )
1017 def to_blog (self ):
Original file line number Diff line number Diff line change 11import reflex as rx
2+ import reflex_local_auth
3+
24
35from .. import navigation
46
@@ -39,12 +41,22 @@ def navbar() -> rx.Component:
3941 spacing = "5" ,
4042 ),
4143 rx .hstack (
42- rx .button (
43- "Sign Up" ,
44- size = "3" ,
45- variant = "outline" ,
44+ rx .link (
45+ rx .button (
46+ "Register" ,
47+ size = "3" ,
48+ variant = "outline" ,
49+ ),
50+ href = reflex_local_auth .routes .REGISTER_ROUTE
51+ ),
52+ rx .link (
53+ rx .button (
54+ "Login" ,
55+ size = "3" ,
56+ variant = "outline" ,
57+ ),
58+ href = reflex_local_auth .routes .LOGIN_ROUTE
4659 ),
47- rx .button ("Log In" , size = "3" ),
4860 spacing = "4" ,
4961 justify = "end" ,
5062 ),
@@ -83,8 +95,10 @@ def navbar() -> rx.Component:
8395 rx .menu .item ("Contact" ,
8496 on_click = navigation .NavState .to_contact ),
8597 rx .menu .separator (),
86- rx .menu .item ("Log in" ),
87- rx .menu .item ("Sign up" ),
98+ rx .menu .item ("Log in" ,
99+ on_click = navigation .NavState .to_login ),
100+ rx .menu .item ("Register" ,
101+ on_click = navigation .NavState .to_register ),
88102 ),
89103 justify = "end" ,
90104 ),
Original file line number Diff line number Diff line change 11reflex == 0.5.3
2+ reflex-local-auth
You can’t perform that action at this time.
0 commit comments