Skip to content

Commit

Permalink
redeploy
Browse files Browse the repository at this point in the history
  • Loading branch information
kleenpulse committed Jul 25, 2024
1 parent 2352149 commit a96b3d0
Show file tree
Hide file tree
Showing 4 changed files with 45 additions and 3 deletions.
File renamed without changes.
6 changes: 4 additions & 2 deletions src/app/(auth-routes)/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { useRouter } from "next-nprogress-bar";
import Image from "next/image";
import Link from "next/link";
import { useSearchParams } from "next/navigation";
import { useState, useTransition } from "react";
import { useEffect, useState, useTransition } from "react";
import { useForm } from "react-hook-form";
import * as z from "zod";

Expand Down Expand Up @@ -80,7 +80,9 @@ const LoginPage = () => {
const togglePasswordVisibility = () => {
setShowPassword(!showPassword);
};

useEffect(() => {
document.title = "Login";
}, []);
return (
<div className="flex min-h-full items-center justify-center px-4 py-10 sm:px-6 lg:px-8">
<div className="w-full max-w-md space-y-8">
Expand Down
2 changes: 1 addition & 1 deletion src/app/layout.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ export default function RootLayout({
return (
<html lang="en">
<body className={inter.className}>
<Providers />
{children}
<Toaster />
<Providers />
</body>
</html>
);
Expand Down
40 changes: 40 additions & 0 deletions src/hooks/user/use-user.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
import { create } from "zustand";
import { persist, PersistStorage } from "zustand/middleware";

type UserProperties = {
name: string | undefined;
email: string | undefined;
id: string | undefined;
};

type ProductsStateProperties = {
user: UserProperties;

updateUser: (user: UserProperties) => void;
};

const storage: PersistStorage<ProductsStateProperties> = {
getItem: (name) => {
const string_ = localStorage.getItem(name);
if (!string_) return;
return JSON.parse(string_);
},
setItem: (name, value) => {
localStorage.setItem(name, JSON.stringify(value));
},
removeItem: (name) => localStorage.removeItem(name),
};

export const useProductsFilters = create<ProductsStateProperties>()(
persist(
(set) => ({
user: {
name: undefined,
email: undefined,
id: undefined,
},
updateUser: (user) => set({ user }),
}),
{ name: "user_session", storage },
),
);

0 comments on commit a96b3d0

Please sign in to comment.