Skip to content

Commit

Permalink
Formated the code
Browse files Browse the repository at this point in the history
  • Loading branch information
somu-code committed Feb 9, 2024
1 parent 1fd3261 commit fa5dc00
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 8 deletions.
8 changes: 4 additions & 4 deletions client/user-client/src/contexts/UserContext.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import { createContext } from "react";

export interface UserContextType {
id: number,
email: string,
name: string,
role: string,
id: number;
email: string;
name: string;
role: string;
}

export const UserContext = createContext<UserContextType | null>(null);
4 changes: 2 additions & 2 deletions client/user-client/src/contexts/UserContextProvider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ReactNode, useState } from "react"
import { ReactNode, useState } from "react";
import { UserContext, UserContextType } from "./UserContext";

export function UserContextProvider({ children }: { children: ReactNode }) {
Expand All @@ -7,5 +7,5 @@ export function UserContextProvider({ children }: { children: ReactNode }) {
<UserContext.Provider value={{ user, setUser }}>
{children}
</UserContext.Provider>
)
);
}
2 changes: 1 addition & 1 deletion client/user-client/src/contexts/old-UserContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const defaultState = {
name: "",
email: "",
},
setUser: (user: User) => { },
setUser: (user: User) => {},
} as UserContextInterface;

export const UserContext = createContext(defaultState);
Expand Down
10 changes: 9 additions & 1 deletion server/src/routes/user.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,15 @@ userRouter.post("/signin", async (req: Request, res: Response) => {
maxAge: 60 * 60 * 1000,
});
}
return res.json({ message: "Logged in successfully", userData: { id: userData.id, email: userData.email, name: userData.name, role: userData.role } });
return res.json({
message: "Logged in successfully",
userData: {
id: userData.id,
email: userData.email,
name: userData.name,
role: userData.role,
},
});
}
} catch (error) {
await prisma.$disconnect();
Expand Down

0 comments on commit fa5dc00

Please sign in to comment.