merge conflict fixes

This commit is contained in:
Taehee Choi
2022-03-13 18:37:40 -07:00
parent 20e8c79bb9
commit 97ed807785
4 changed files with 81 additions and 99 deletions
+1 -1
View File
@@ -23,7 +23,7 @@ const App: React.FC = () => {
<Route element={<ProtectedRoute />}>
<Route path="/" element={<Home />} />
<Route path="/contacts" element={<Contacts />} />
<Route path="/calendar" element={<Calendar />} />
<Route path="/calendar" element={<CalendarPage />} />
</Route>
</Routes>
</Router>
+24 -3
View File
@@ -13,6 +13,8 @@ interface LocationState {
from: { pathname: string };
}
const Login: React.FC = () => {
const setAuth = useAuth();
const navigate = useNavigate();
const location = useLocation();
const state = location.state as LocationState;
@@ -38,7 +40,7 @@ const Login: React.FC = () => {
// setAuth({username: username, isLoggedIn: true});
setAuth["username"] = username;
setAuth["isLoggedIn"] = true;
navigate(from, {replace: true});
navigate(from, { replace: true });
}
setUsername("");
setPassword("");
@@ -49,8 +51,27 @@ const Login: React.FC = () => {
<Stack className="grid-container" spacing={2}>
<img className="login-logo" src={hsbcLogo} alt="HSBC Logo" />
{/* <p ref={errRef} className={errMsg ? "errmsg" : "offscreen"} aria-live="assertive">{errMsg}</p> */}
<TextField className="username-input" id="outlined-basic" label="Username" variant="outlined" placeholder="Username" onChange={(event) => {setUsername(event.target.value);}}/>
<TextField className="password-input" id="outlined-basic" label="Password" variant="outlined" placeholder="Password" type="password" onChange={(event) => {setPassword(event.target.value);}}/>
<TextField
className="username-input"
id="outlined-basic"
label="Username"
variant="outlined"
placeholder="Username"
onChange={(event) => {
setUsername(event.target.value);
}}
/>
<TextField
className="password-input"
id="outlined-basic"
label="Password"
variant="outlined"
placeholder="Password"
type="password"
onChange={(event) => {
setPassword(event.target.value);
}}
/>
<Stack direction="row" justifyContent="space-between" spacing={2}>
<a className="register-btn" href="#">
<Typography sx={{ ml: 1, mb: 1 }}>Forgot your password?</Typography>
+8 -9
View File
@@ -5,16 +5,15 @@ interface loginInfo {
isLoggedIn: boolean;
}
const AuthContext = createContext<loginInfo>({username: "", isLoggedIn: false});
const AuthContext = createContext<loginInfo>({
username: "",
isLoggedIn: false,
});
export const AuthProvider = ({ children }: {children: React.ReactNode}) => {
const [auth] = useState<loginInfo>({username: "", isLoggedIn: false});
export const AuthProvider = ({ children }: { children: React.ReactNode }) => {
const [auth] = useState<loginInfo>({ username: "", isLoggedIn: false });
return (
<AuthContext.Provider value={auth}>
{children}
</AuthContext.Provider>
);
return <AuthContext.Provider value={auth}>{children}</AuthContext.Provider>;
};
export default AuthContext;
export default AuthContext;