Skip to content

Commit 1e786b2

Browse files
committed
feat(welcome): Add Welcome component to display login or welcome message based on authentication state
1 parent d8a27cc commit 1e786b2

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

app/features/welcome/index.tsx

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
import Login from "~/features/login";
2+
3+
import { useAuth } from "~/providers/AuthProvider";
4+
5+
export default function Welcome() {
6+
const { isLogin, isLoading } = useAuth();
7+
8+
if (isLoading) {
9+
return <div>Loading...</div>;
10+
}
11+
12+
return (
13+
<>
14+
{isLogin ? (
15+
<div>
16+
<h1>Welcome to the app</h1>
17+
</div>
18+
) : (
19+
<Login />
20+
)}
21+
</>
22+
);
23+
}

app/routes/home.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import Login from "~/features/login";
1+
import Welcome from "~/features/welcome";
22

33
export function meta() {
44
return [
@@ -8,5 +8,5 @@ export function meta() {
88
}
99

1010
export default function Home() {
11-
return <Login />;
11+
return <Welcome />;
1212
}

0 commit comments

Comments
 (0)