File tree Expand file tree Collapse file tree 5 files changed +25
-13
lines changed Expand file tree Collapse file tree 5 files changed +25
-13
lines changed Original file line number Diff line number Diff line change 1
1
/** @type {import('next').NextConfig } */
2
2
const nextConfig = {
3
+ eslint : {
4
+ // Warning: This allows production builds to successfully complete even if
5
+ // your project has ESLint errors.
6
+ ignoreDuringBuilds : true ,
7
+ } ,
3
8
4
9
webpackDevMiddleware : ( config ) => {
5
10
config . watchOptions = {
Original file line number Diff line number Diff line change 1
- import { FaGithub , FaGoogle } from "react-icons/fa" ;
1
+ const SocialButton = ( { } ) => {
2
+ return < div className = "bg-primary-foreground" > </ div > ;
3
+ } ;
2
4
3
- const SocialButton = ( { } ) => {
4
- return (
5
- < div className = "bg-primary-foreground" >
6
- </ div >
7
- )
8
- }
9
-
10
- export default SocialButton
5
+ export default SocialButton ;
Original file line number Diff line number Diff line change
1
+ import { Toaster } from "@/components/ui/toaster" ;
1
2
import { ReactNode } from "react" ;
2
3
3
4
export default function AuthLayout ( { children } : { children : ReactNode } ) {
4
5
return (
5
6
< >
6
7
< main > { children } </ main >
8
+ < Toaster />
7
9
</ >
8
10
) ;
9
11
}
Original file line number Diff line number Diff line change @@ -15,6 +15,7 @@ import { z } from "zod";
15
15
import { zodResolver } from "@hookform/resolvers/zod" ;
16
16
import { login } from "@/services/authService" ;
17
17
import { useRouter } from "next/navigation" ;
18
+ import { useToast } from "@/hooks/use-toast" ;
18
19
19
20
const FormSchema = z . object ( {
20
21
email : z . string ( ) ,
@@ -24,6 +25,8 @@ const FormSchema = z.object({
24
25
export default function DashboardPage ( ) {
25
26
const router = useRouter ( ) ;
26
27
28
+ const { toast } = useToast ( ) ;
29
+
27
30
const methods = useForm < z . infer < typeof FormSchema > > ( {
28
31
resolver : zodResolver ( FormSchema ) ,
29
32
} ) ;
@@ -42,12 +45,20 @@ export default function DashboardPage() {
42
45
"access_token" ,
43
46
accessTokenResponse . data . access_token
44
47
) ;
48
+ toast ( {
49
+ title : "Successfully Logged in!" ,
50
+ description : "You should be redirect to /dashboard" ,
51
+ } ) ;
45
52
router . push ( "/dashboard" ) ;
46
53
} else {
54
+ toast ( {
55
+ title : "Error!" ,
56
+ description : accessTokenResponse . message ,
57
+ } ) ;
47
58
// TODO: Display error message
48
59
}
49
60
} ,
50
- [ router ]
61
+ [ router , toast ]
51
62
) ;
52
63
53
64
return (
Original file line number Diff line number Diff line change 5
5
AccessTokenPayload ,
6
6
AccessTokenPayloadSchema ,
7
7
} from "@/types/Token" ;
8
- import { UserProfile } from "@/types/User" ;
9
8
import React , {
10
9
createContext ,
11
10
useContext ,
@@ -14,11 +13,11 @@ import React, {
14
13
PropsWithChildren ,
15
14
} from "react" ;
16
15
17
- const UserContext = createContext < UserProfile | undefined > ( undefined ) ;
16
+ const UserContext = createContext < AccessTokenPayload | undefined > ( undefined ) ;
18
17
19
18
export function UserProvider ( { children } : PropsWithChildren ) {
20
19
// TODO: Once User Service is implemented on the backend, fetch user profile
21
- const [ user , setUser ] = useState < UserProfile > ( ) ;
20
+ const [ user , setUser ] = useState < AccessTokenPayload > ( ) ;
22
21
23
22
useEffect ( ( ) => {
24
23
const token = localStorage . getItem ( "access_token" ) ;
You can’t perform that action at this time.
0 commit comments