File tree 4 files changed +44
-8
lines changed
4 files changed +44
-8
lines changed Original file line number Diff line number Diff line change 1
1
"""Welcome to Reflex! This file outlines the steps to create a basic app."""
2
2
3
3
import reflex as rx
4
+ import reflex_local_auth
4
5
5
6
from rxconfig import config
6
7
from .ui .base import base_page
@@ -46,6 +47,19 @@ def index() -> rx.Component:
46
47
47
48
app = rx .App ()
48
49
app .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
49
63
app .add_page (pages .about_page ,
50
64
route = navigation .routes .ABOUT_US_ROUTE )
51
65
Original file line number Diff line number Diff line change 1
1
import reflex as rx
2
-
2
+ import reflex_local_auth
3
3
from . import routes
4
4
5
5
class NavState (rx .State ):
6
6
def to_home (self ):
7
7
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
+
8
15
def to_about_us (self ):
9
16
return rx .redirect (routes .ABOUT_US_ROUTE )
10
17
def to_blog (self ):
Original file line number Diff line number Diff line change 1
1
import reflex as rx
2
+ import reflex_local_auth
3
+
2
4
3
5
from .. import navigation
4
6
@@ -39,12 +41,22 @@ def navbar() -> rx.Component:
39
41
spacing = "5" ,
40
42
),
41
43
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
46
59
),
47
- rx .button ("Log In" , size = "3" ),
48
60
spacing = "4" ,
49
61
justify = "end" ,
50
62
),
@@ -83,8 +95,10 @@ def navbar() -> rx.Component:
83
95
rx .menu .item ("Contact" ,
84
96
on_click = navigation .NavState .to_contact ),
85
97
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 ),
88
102
),
89
103
justify = "end" ,
90
104
),
Original file line number Diff line number Diff line change 1
1
reflex == 0.5.3
2
+ reflex-local-auth
You can’t perform that action at this time.
0 commit comments