diff --git a/.env.example b/.env.example
index 4a84447..40d1099 100644
--- a/.env.example
+++ b/.env.example
@@ -1 +1 @@
-NEXT_PUBLIC_BACKEND_URL="http://127.0.0.1:9000/api/v1"
+NEXT_PUBLIC_BACKEND_URL="http://127.0.0.1:9000/woc/api/v1"
diff --git a/app/auth/callback/page.tsx b/app/auth/callback/page.tsx
index 67935da..889f7c3 100644
--- a/app/auth/callback/page.tsx
+++ b/app/auth/callback/page.tsx
@@ -2,45 +2,33 @@
import { useAuthStore } from '@/app/store/useAuthStore';
import { useRouter, useSearchParams } from 'next/navigation';
-import { useEffect } from 'react';
-import { Suspense } from 'react';
+import { Suspense, useEffect } from 'react';
import toast from 'react-hot-toast';
-function AuthCallbackContent() {
- const router = useRouter();
+const CallbackContent = () => {
const searchParams = useSearchParams();
- const { setUser } = useAuthStore();
+ const router = useRouter();
+ const { setTokens } = useAuthStore();
useEffect(() => {
const accessToken = searchParams.get('access_token');
const refreshToken = searchParams.get('refresh_token');
const githubUsername = searchParams.get('github_username');
const email = searchParams.get('email');
- const bountyStr = searchParams.get('bounty');
- const error = searchParams.get('error');
-
- if (error) {
- toast.error('Authentication Error');
- router.push('/');
- return;
- }
if (accessToken && refreshToken && githubUsername && email) {
- // update the auth store with the new data
- setUser({
- access_token: accessToken,
- refresh_token: refreshToken,
- github_username: githubUsername,
- email: email,
- bounty: bountyStr ? Number.parseInt(bountyStr) : 0,
+ setTokens({
+ accessToken,
+ refreshToken,
+ githubUsername,
+ email,
+ bounty: 0,
});
-
- toast.success('GitHub account linked successfully!');
router.push('/');
} else {
- router.push('/');
+ router.push('/login');
}
- }, [searchParams, setUser, router]);
+ }, [searchParams, router, setTokens]);
return (
@@ -49,9 +37,9 @@ function AuthCallbackContent() {
);
-}
+};
-export default function AuthCallback() {
+const AuthCallbackPage = () => {
return (
}
>
-
+
);
-}
+};
+
+export default AuthCallbackPage;
diff --git a/app/components/Navbar.tsx b/app/components/Navbar.tsx
index 824423c..4c98ca8 100644
--- a/app/components/Navbar.tsx
+++ b/app/components/Navbar.tsx
@@ -20,7 +20,7 @@ const Navbar = () => {
const router = useRouter();
const user = useAuthStore((state) => state.user);
const clearUser = useAuthStore((state) => state.clearUser);
- const github_username = user?.github_username || '';
+ const githubUsername = user?.githubUsername || '';
const { classes } = useTheme();
useEffect(() => {
@@ -162,8 +162,8 @@ const Navbar = () => {
@@ -235,8 +235,8 @@ const Navbar = () => {