-
-
-
MeetMate
-
-
-
-
-
-
-
-
- Welcome back, Tim
-
-
-
-
-
-
-
-
-
-
shadcn
-
m@example.com
-
-
-
- Settings
-
-
- Log out
-
-
-
-
-
+
-
-
MeetMate Dashboard
-
Create your appointments in minutes
-
-
+
+
MeetMate Dashboard
+
Create your appointments in minutes
+
+
-
+
-
-
-
-
+
);
}
diff --git a/src/app/dashboard/settings/page.tsx b/src/app/dashboard/settings/page.tsx
new file mode 100644
index 0000000..e6f0954
--- /dev/null
+++ b/src/app/dashboard/settings/page.tsx
@@ -0,0 +1,5 @@
+function Settings() {
+ return
Settings
;
+}
+
+export default Settings;
diff --git a/src/app/login/page.tsx b/src/app/login/page.tsx
index 02508f5..1b8db0c 100644
--- a/src/app/login/page.tsx
+++ b/src/app/login/page.tsx
@@ -47,6 +47,9 @@ const LoginForm = () => {
variant: "default",
className: "border-emerald-300"
});
+ setTimeout(() => {
+ router.push("/dashboard");
+ }, 1500);
}
}, [formState, toast, dispatch]);
diff --git a/src/lib/actions.ts b/src/lib/actions.ts
index 9afcb58..1349d29 100644
--- a/src/lib/actions.ts
+++ b/src/lib/actions.ts
@@ -97,7 +97,7 @@ export async function getUser(accessToken?: string): Promise
{
if (response.ok) {
return (await response.json()) as User;
} else {
- console.log(response.status);
+ console.log("Error getting User", response.status);
return null;
}
} catch (error) {
@@ -106,6 +106,10 @@ export async function getUser(accessToken?: string): Promise {
}
}
+export async function getAccessToken() {
+ return cookies().get("accessToken")?.value;
+}
+
type LoginFormState = {
message: string;
errors: Record | undefined;
diff --git a/src/lib/utils.ts b/src/lib/utils.ts
index d084cca..9a60cba 100644
--- a/src/lib/utils.ts
+++ b/src/lib/utils.ts
@@ -1,6 +1,20 @@
-import { type ClassValue, clsx } from "clsx"
-import { twMerge } from "tailwind-merge"
+import { type ClassValue, clsx } from "clsx";
+import { twMerge } from "tailwind-merge";
export function cn(...inputs: ClassValue[]) {
- return twMerge(clsx(inputs))
+ return twMerge(clsx(inputs));
+}
+
+export function extractNameInitials(name: string | undefined) {
+ if (name === undefined) {
+ return "";
+ }
+ const parts = name.trim().split(/\s+/);
+ let initials = parts[0][0];
+
+ if (parts.length > 1) {
+ initials += parts[parts.length - 1][0];
+ }
+
+ return initials.toUpperCase();
}
diff --git a/src/middleware.ts b/src/middleware.ts
index c2b6979..3e6b308 100644
--- a/src/middleware.ts
+++ b/src/middleware.ts
@@ -12,7 +12,6 @@ export async function middleware(req: NextRequest) {
if (refreshToken !== undefined || refreshToken !== "") {
const newAccessToken = await refreshAccessToken(refreshToken);
if (newAccessToken !== undefined) {
- console.log(newAccessToken);
response.cookies.set("accessToken", newAccessToken[0], { httpOnly: true, secure: true, sameSite: "strict" });
response.cookies.set("expires_at", newAccessToken[1], { httpOnly: true, secure: true, sameSite: "strict" });
user = await getUser(newAccessToken[0]);