-
-
- Welcome back
-
- Login with your Github or Google account
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+ Skillify.io
+
+
+
+ Login with your Github or Google account
+
+
+
+
+
+
+
+
);
}
diff --git a/components/auth/signup-form.tsx b/components/auth/signup-form.tsx
index 65a28eb..e4c2af4 100644
--- a/components/auth/signup-form.tsx
+++ b/components/auth/signup-form.tsx
@@ -2,186 +2,169 @@
import { cn } from "@/lib/utils";
import { Button } from "@/components/ui/button";
import {
- Card,
- CardContent,
- CardDescription,
- CardHeader,
- CardTitle,
+ Card,
+ CardContent,
+ CardDescription,
+ CardHeader,
+ CardTitle,
} from "@/components/ui/card";
import { Input } from "@/components/ui/input";
import { Label } from "@/components/ui/label";
-import useUserStore from "../../zustand/userStore";
import axios from "axios";
-import useAuthenticate from "@/hooks/useAuthenticate";
import { useRouter } from "next/navigation";
import { Tabs, TabsContent, TabsList, TabsTrigger } from "@/components/ui/tabs";
-import { AuthSignupButton } from "@/components/ui/AuthSignupButton";
+import { Role } from "@/types";
+import { GalleryVerticalEnd} from "lucide-react";
+import Link from "next/link";
+import toast from "react-hot-toast";
export function SignupForm({
- className,
- ...props
+ className,
+ ...props
}: React.ComponentPropsWithoutRef<"div">) {
- const { signIn } = useAuthenticate();
+ const router = useRouter();
- const handleSignup = async (formData: FormData) => {
- const name = formData.get("name");
- const email = formData.get("email");
- const password = formData.get("password");
- const role = formData.get("role");
- console.log(role);
- const router = useRouter();
- try {
- const req = await axios.post("/api/v1/auth/signup", {
- name,
- email,
- password,
- role,
- });
- router.replace("/login");
- } catch (err) {
- alert(`singupError: ` + err);
- }
- };
- // const { data, user } = req.data;
- return (
-
-
- Welcome back
-
-
- Signup with your Github or Google account
-
-
-
-
-
- As recruter
-
-
- As a candidate
-
-
-
-
-
-
-
-
-
-
-
- By clicking continue, you agree to our
Terms of Service{" "}
- and
Privacy Policy.
+ const handleSignup = async (formData: FormData) => {
+ const username = formData.get("username");
+ const email = formData.get("email");
+ const password = formData.get("password");
+ const role = formData.get("role");
+ try {
+ const req = await axios.post(`${process.env.NEXT_PUBLIC_API_URL}/register`, {
+ username,
+ email,
+ password,
+ role,
+ });
+ if (req.status === 200) toast.success("Signup successful");
+ setTimeout(() => {
+ router.replace("/login");
+ }, 2000);
+ } catch (err) {
+ toast.error("Signup failed");
+ }
+ };
+ return (
+
- );
+
Skillify.io
+
+
+
+
+ Signup to our platform and get started
+
+
+
+
+ As a candidate
+
+
+ As a recruter
+
+
+
+
+
+
+
+
+
+
+
+
+ );
}
-function SignUpContent({ role, handleSignup }) {
- const { signIn } = useAuthenticate();
- return (
-
-
+
+ );
}
diff --git a/components/ui/Loader.tsx b/components/ui/Loader.tsx
new file mode 100644
index 0000000..b29146f
--- /dev/null
+++ b/components/ui/Loader.tsx
@@ -0,0 +1,12 @@
+// components/Loading.tsx
+"use client";
+
+import { PulseLoader } from "react-spinners";
+
+export default function Loader() {
+ return (
+
+ );
+}
diff --git a/components/ui/skeleton.tsx b/components/ui/skeleton.tsx
new file mode 100644
index 0000000..d7e45f7
--- /dev/null
+++ b/components/ui/skeleton.tsx
@@ -0,0 +1,15 @@
+import { cn } from "@/lib/utils"
+
+function Skeleton({
+ className,
+ ...props
+}: React.HTMLAttributes
) {
+ return (
+
+ )
+}
+
+export { Skeleton }
diff --git a/middleware.ts b/middleware.ts
index 252c9bc..62fdbe9 100644
--- a/middleware.ts
+++ b/middleware.ts
@@ -1,17 +1,21 @@
-import { authConfig } from "@/app/api/auth/[...nextauth]/route";
-import NextAuth from "next-auth";
+// import { authConfig } from "@/app/api/auth/[...nextauth]/route";
+// import NextAuth from "next-auth";
-const { auth } = NextAuth(authConfig);
+// const { auth } = NextAuth(authConfig);
-export default auth((req: any) => {
- const isAuthenticated = !!req.auth;
+// export default auth((req: any) => {
+// const isAuthenticated = !!req.auth;
- if (!isAuthenticated) {
- return Response.redirect(new URL("/auth/signin", req.url));
- }
-});
+// if (!isAuthenticated) {
+// return Response.redirect(new URL("/login", req.url));
+// }
+// });
-// Apply middleware to specific routes
-export const config = {
- matcher: ["/dashboard/:path*"], // Protect all routes under /dashboard
-};
+// // Apply middleware to specific routes
+// export const config = {
+// matcher: ["/dashboard/:path*"], // Protect all routes under /dashboard
+// };
+
+export default function Middleware() {
+ return null;
+}
diff --git a/package-lock.json b/package-lock.json
index e835c07..374e63d 100644
--- a/package-lock.json
+++ b/package-lock.json
@@ -21,6 +21,8 @@
"next-auth": "^4.24.11",
"react": "^19.0.0",
"react-dom": "^19.0.0",
+ "react-hot-toast": "^2.5.1",
+ "react-spinners": "^0.15.0",
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7",
"zustand": "^5.0.3"
@@ -2316,7 +2318,6 @@
"version": "3.1.3",
"resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz",
"integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==",
- "devOptional": true,
"license": "MIT"
},
"node_modules/damerau-levenshtein": {
@@ -3574,6 +3575,15 @@
"url": "https://github.com/sponsors/ljharb"
}
},
+ "node_modules/goober": {
+ "version": "2.1.16",
+ "resolved": "https://registry.npmjs.org/goober/-/goober-2.1.16.tgz",
+ "integrity": "sha512-erjk19y1U33+XAMe1VTvIONHYoSqE4iS7BYUZfHaqeohLmnC0FdxEh7rQU+6MZ4OajItzjZFSRtVANrQwNq6/g==",
+ "license": "MIT",
+ "peerDependencies": {
+ "csstype": "^3.0.10"
+ }
+ },
"node_modules/gopd": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz",
@@ -5335,6 +5345,23 @@
"react": "^19.0.0"
}
},
+ "node_modules/react-hot-toast": {
+ "version": "2.5.1",
+ "resolved": "https://registry.npmjs.org/react-hot-toast/-/react-hot-toast-2.5.1.tgz",
+ "integrity": "sha512-54Gq1ZD1JbmAb4psp9bvFHjS7lje+8ubboUmvKZkCsQBLH6AOpZ9JemfRvIdHcfb9AZXRaFLrb3qUobGYDJhFQ==",
+ "license": "MIT",
+ "dependencies": {
+ "csstype": "^3.1.3",
+ "goober": "^2.1.16"
+ },
+ "engines": {
+ "node": ">=10"
+ },
+ "peerDependencies": {
+ "react": ">=16",
+ "react-dom": ">=16"
+ }
+ },
"node_modules/react-is": {
"version": "16.13.1",
"resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz",
@@ -5342,6 +5369,16 @@
"dev": true,
"license": "MIT"
},
+ "node_modules/react-spinners": {
+ "version": "0.15.0",
+ "resolved": "https://registry.npmjs.org/react-spinners/-/react-spinners-0.15.0.tgz",
+ "integrity": "sha512-ZO3/fNB9Qc+kgpG3SfdlMnvTX6LtLmTnOogb3W6sXIaU/kZ1ydEViPfZ06kSOaEsor58C/tzXw2wROGQu3X2pA==",
+ "license": "MIT",
+ "peerDependencies": {
+ "react": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0",
+ "react-dom": "^16.0.0 || ^17.0.0 || ^18.0.0 || ^19.0.0"
+ }
+ },
"node_modules/read-cache": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/read-cache/-/read-cache-1.0.0.tgz",
diff --git a/package.json b/package.json
index 6383968..425db73 100644
--- a/package.json
+++ b/package.json
@@ -23,6 +23,8 @@
"next-auth": "^4.24.11",
"react": "^19.0.0",
"react-dom": "^19.0.0",
+ "react-hot-toast": "^2.5.1",
+ "react-spinners": "^0.15.0",
"tailwind-merge": "^2.6.0",
"tailwindcss-animate": "^1.0.7",
"zustand": "^5.0.3"
diff --git a/types.ts b/types.ts
index 7b9528b..14398b7 100644
--- a/types.ts
+++ b/types.ts
@@ -13,3 +13,11 @@ export interface UserStoreState {
setExpiration: (expiresAt: number | null) => void;
clearUser: () => void;
}
+
+
+
+export enum Role {
+ ROLE_ADMIN = 'ROLE_ADMIN',
+ ROLE_RECRUITER = 'ROLE_RECRUITER',
+ ROLE_CANDIDATE = 'ROLE_CANDIDATE',
+}