Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

added Auth react context #91

Merged
merged 11 commits into from
Jul 13, 2024
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 0 additions & 14 deletions Tajpuriya quotes.txt

This file was deleted.

2 changes: 2 additions & 0 deletions nepalingo-web/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"react": "^18.3.1",
"react-dom": "^18.3.1",
"react-router-dom": "^6.24.1",
"react-supabase": "^0.2.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you still using react-supabase? You can run pnpm remove react-supabase to get rid of it if you don't need it anymore

https://chatgpt.com/share/04fc4457-0e8f-40f1-b135-e59fe0c94d16

"swr": "^2.2.5"
},
"devDependencies": {
Expand All @@ -36,6 +37,7 @@
"ts-node": "^10.9.2",
"typescript": "^5.5.2",
"vite": "^5.3.1",
"vite-plugin-string": "^1.2.3",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

did you add this? what is it for?

"vite-tsconfig-paths": "^4.3.2"
}
}
97 changes: 78 additions & 19 deletions nepalingo-web/pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Empty file.
Empty file.
4 changes: 4 additions & 0 deletions nepalingo-web/public/quotes/tajpuriya.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
"जैठा तक दमल ड छोक ऐठा तक जाईस, आगुबिती जलेसे दमाल ड ऐठा जाए हुना दख्बो","Walk as far as you can see the road, The way forward is visible after reaching there"
"सफलतर सुरुवत सबै दिन आसफलतारसे हल्कु","Success always begins with failure"
"जैला ठिक हो ऐला करिस, जैला सजिलो लगेसोक ऐल ना करिस","Do what is right, not what is easy"
"जैला जीवन डक समयर महत्व रखेसेक ओईला आप्नाई आप्नाक जनेसेक","The one who has accepted the time in life has known himself"
27 changes: 15 additions & 12 deletions nepalingo-web/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
import User_auth from "./components/userAuth/UserAuth";
import Home from "./pages/Home/Home";
import supabase from "./components/userAuth/supabaseClient";
import { UserProvider } from "./components/userAuth/UserContext";

const App: React.FC = () => {
const [isAuthenticated, setIsAuthenticated] = useState(false);
Expand Down Expand Up @@ -36,18 +37,20 @@ const App: React.FC = () => {
}, []);

return (
<Router>
<Routes>
<Route path="/login" element={<User_auth />} />
{/* Protect the / route, redirect to /login if not authenticated */}
<Route
path="/"
element={isAuthenticated ? <Home /> : <Navigate to="/login" />}
/>
{/* Default route redirects to /login */}
<Route path="/" element={<Navigate to="/login" />} />
</Routes>
</Router>
<UserProvider>
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!!

<Router>
<Routes>
<Route path="/login" element={<User_auth />} />
{/* Protect the / route, redirect to /login if not authenticated */}
<Route
path="/"
element={isAuthenticated ? <Home /> : <Navigate to="/login" />}
/>
{/* Default route redirects to /login */}
<Route path="/" element={<Navigate to="/login" />} />
</Routes>
</Router>
</UserProvider>
);
};

Expand Down
Loading
Loading