diff --git a/public/images/goggle.svg b/public/images/google.svg
similarity index 100%
rename from public/images/goggle.svg
rename to public/images/google.svg
diff --git a/src/app/(auth-routes)/login/page.tsx b/src/app/(auth-routes)/login/page.tsx
index 5de3c9d0b..8d1200af9 100644
--- a/src/app/(auth-routes)/login/page.tsx
+++ b/src/app/(auth-routes)/login/page.tsx
@@ -23,6 +23,7 @@ import {
FormMessage,
} from "~/components/ui/form";
import { Input } from "~/components/ui/input";
+import { useUser } from "~/hooks/user/use-user";
import { simulateDelay } from "~/lib/utils";
const loginSchema = z.object({
@@ -53,6 +54,7 @@ const LoginPage = () => {
const searchP = useSearchParams();
const callback_url = searchP.get("callbackUrl");
const [isLoading, startTransition] = useTransition();
+ const { updateUser } = useUser();
const form = useForm({
resolver: zodResolver(loginSchema),
@@ -68,7 +70,7 @@ const LoginPage = () => {
startTransition(async () => {
await simulateDelay(3);
await loginUser(values);
-
+ updateUser({ email: values.email, name: values.email.split("@")[0] });
if (callback_url) {
router.push(callback_url);
} else {
diff --git a/src/app/(auth-routes)/register/page.tsx b/src/app/(auth-routes)/register/page.tsx
index ce3b5aa33..5d50ba109 100644
--- a/src/app/(auth-routes)/register/page.tsx
+++ b/src/app/(auth-routes)/register/page.tsx
@@ -23,6 +23,8 @@ import {
InputOTPGroup,
InputOTPSlot,
} from "~/components/ui/input-otp";
+import Google from "../../../../public/images/google.svg";
+import Facebook from "../../../../public/images/facebook.svg";
const formSchema = z.object({
fullname: z.string().min(2, {
@@ -53,14 +55,8 @@ const SignUp = () => {
- {!is_auth_path && (
+ {!is_auth_path && !user.email && (
{
)}
+ {user.email && }
diff --git a/src/hooks/user/use-user.ts b/src/hooks/user/use-user.ts
index cfa8f5871..57bce0982 100644
--- a/src/hooks/user/use-user.ts
+++ b/src/hooks/user/use-user.ts
@@ -4,7 +4,6 @@ import { persist, PersistStorage } from "zustand/middleware";
type UserProperties = {
name: string | undefined;
email: string | undefined;
- id: string | undefined;
};
type ProductsStateProperties = {
@@ -25,13 +24,12 @@ const storage: PersistStorage
= {
removeItem: (name) => localStorage.removeItem(name),
};
-export const useProductsFilters = create()(
+export const useUser = create()(
persist(
(set) => ({
user: {
name: undefined,
email: undefined,
- id: undefined,
},
updateUser: (user) => set({ user }),
}),
diff --git a/src/lib/services/session.ts b/src/lib/services/session.ts
index 7d731c4fb..ebefa26de 100644
--- a/src/lib/services/session.ts
+++ b/src/lib/services/session.ts
@@ -78,5 +78,6 @@ export async function updateSession() {
}
export async function deleteSession() {
+ deleteCookie("session");
deleteCookie("session", { cookies });
}