Skip to content

Commit a3000eb

Browse files
authored
Merge pull request #73 from CS3219-AY2425S1/ms3
Ms3
2 parents d674335 + 5a085f5 commit a3000eb

File tree

5 files changed

+25
-13
lines changed

5 files changed

+25
-13
lines changed

frontend/next.config.mjs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
/** @type {import('next').NextConfig} */
22
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+
},
38

49
webpackDevMiddleware: (config) => {
510
config.watchOptions = {
Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,5 @@
1-
import { FaGithub, FaGoogle } from "react-icons/fa";
1+
const SocialButton = ({}) => {
2+
return <div className="bg-primary-foreground"></div>;
3+
};
24

3-
const SocialButton = ({ }) => {
4-
return (
5-
<div className="bg-primary-foreground">
6-
</div>
7-
)
8-
}
9-
10-
export default SocialButton
5+
export default SocialButton;

frontend/src/app/signin/layout.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
import { Toaster } from "@/components/ui/toaster";
12
import { ReactNode } from "react";
23

34
export default function AuthLayout({ children }: { children: ReactNode }) {
45
return (
56
<>
67
<main>{children}</main>
8+
<Toaster />
79
</>
810
);
911
}

frontend/src/app/signin/page.tsx

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import { z } from "zod";
1515
import { zodResolver } from "@hookform/resolvers/zod";
1616
import { login } from "@/services/authService";
1717
import { useRouter } from "next/navigation";
18+
import { useToast } from "@/hooks/use-toast";
1819

1920
const FormSchema = z.object({
2021
email: z.string(),
@@ -24,6 +25,8 @@ const FormSchema = z.object({
2425
export default function DashboardPage() {
2526
const router = useRouter();
2627

28+
const { toast } = useToast();
29+
2730
const methods = useForm<z.infer<typeof FormSchema>>({
2831
resolver: zodResolver(FormSchema),
2932
});
@@ -42,12 +45,20 @@ export default function DashboardPage() {
4245
"access_token",
4346
accessTokenResponse.data.access_token
4447
);
48+
toast({
49+
title: "Successfully Logged in!",
50+
description: "You should be redirect to /dashboard",
51+
});
4552
router.push("/dashboard");
4653
} else {
54+
toast({
55+
title: "Error!",
56+
description: accessTokenResponse.message,
57+
});
4758
// TODO: Display error message
4859
}
4960
},
50-
[router]
61+
[router, toast]
5162
);
5263

5364
return (

frontend/src/contexts/UserContext.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ import {
55
AccessTokenPayload,
66
AccessTokenPayloadSchema,
77
} from "@/types/Token";
8-
import { UserProfile } from "@/types/User";
98
import React, {
109
createContext,
1110
useContext,
@@ -14,11 +13,11 @@ import React, {
1413
PropsWithChildren,
1514
} from "react";
1615

17-
const UserContext = createContext<UserProfile | undefined>(undefined);
16+
const UserContext = createContext<AccessTokenPayload | undefined>(undefined);
1817

1918
export function UserProvider({ children }: PropsWithChildren) {
2019
// TODO: Once User Service is implemented on the backend, fetch user profile
21-
const [user, setUser] = useState<UserProfile>();
20+
const [user, setUser] = useState<AccessTokenPayload>();
2221

2322
useEffect(() => {
2423
const token = localStorage.getItem("access_token");

0 commit comments

Comments
 (0)