Skip to content

Commit 249cfcc

Browse files
committed
Merge branch 'ms4' into ms4-jared/matching
2 parents cd130dd + 353ec8d commit 249cfcc

File tree

8 files changed

+36
-37
lines changed

8 files changed

+36
-37
lines changed

README.md

Lines changed: 0 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -9,27 +9,3 @@
99
- You can choose to develop individual microservices within separate folders within this repository **OR** use individual repositories (all public) for each microservice.
1010
- In the latter scenario, you should enable sub-modules on this GitHub classroom repository to manage the development/deployment **AND** add your mentor to the individual repositories as a collaborator.
1111
- The teaching team should be given access to the repositories as we may require viewing the history of the repository in case of any disputes or disagreements.
12-
13-
## For Development:
14-
15-
### Backend:
16-
17-
To launch the development environment using Docker Compose, follow these steps:
18-
19-
1. Enter backend directory
20-
21-
```
22-
cd backend
23-
```
24-
25-
2. Run docker-compose using `-f` flag to specify the file to build from and `-d` flag to run the containers in detached mode (in the background)
26-
27-
```
28-
docker-compose -f docker-compose.yml up -d
29-
```
30-
31-
3. To stop the running services
32-
33-
```
34-
docker-compose down
35-
```

backend/docker-compose.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ services:
2222
- matching-service
2323
networks:
2424
- backend-network
25+
- shared-network
2526

2627
question-service:
2728
build:
@@ -90,3 +91,5 @@ services:
9091
networks:
9192
backend-network:
9293
driver: bridge
94+
shared-network:
95+
driver: bridge

frontend/docker-compose.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,19 @@ services:
33
build:
44
context: .
55
dockerfile: Dockerfile
6+
container_name: frontend-service
67
volumes:
78
- .:/app
89
- /app/node_modules
910
ports:
1011
- "3000:3000"
1112
environment:
1213
- NODE_ENV=development
14+
- PUBLIC_API_URL=http://gateway-service:4000
15+
networks:
16+
- backend_shared-network
1317
command: npm run dev
18+
19+
networks:
20+
backend_shared-network:
21+
external: true

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)