정의왕

Fix file

......@@ -17,18 +17,19 @@ router.post('/',(req,res)=>{
//id와 일치하는 정보가 없는경우
if(result === null || result === undefined){
console.log("일치하는 id가 없습니다.")
res.sendStatus(401);
res.status(401).send("idError");
}
//비밀번호 불일치
else if(result.dataValues.pw != req.body.Password){
console.log("일치하는 pw가 없습니다.")
res.sendStatus(401);
res.status(401).send("pwError");
}
else if(result.dataValues.pw == req.body.Password){
req.session.id = result.dataValues.id;
req.session.name = result.dataValues.name;
req.session.personality = result.dataValues.personality;
req.session.status = result.dataValues.status;
req.session.isAuthorized = true;
console.log("Login");
res.sendStatus(200);
}
......
import {BrowserRouter as Router, Route, Routes} from "react-router-dom";
import {BrowserRouter as Redirect, Router, Route, Routes} from "react-router-dom";
import MainPage from "./component/views/MainPage/MainPage";
import LoginPage from "./component/views/LoginPage/LoginPage";
import RegisterPage from "./component/views/RegisterPage/RegisterPage";
import "./static/fonts/font.css";
import LandingPage from "./component/views/LandingPage/LandingPage";
function App () {
let isAuthorized = sessionStorage.getItem("isAuthorized"); //
return (
<Router>
<div>
{!isAuthorized ? <Redirect to="/login" /> : <Redirect to="/" />}
{!isAuthorized ? <Redirect to="/login" /> : <Redirect to="/main" />}
<Routes>
<Route exact path = "/" element={<LandingPage/>}/>
<Route exact path = "/login" element={<LoginPage/>}/>
<Route exact path = "/main" element={<MainPage/>}/>
<Route exact path = "/register" element={<RegisterPage/>}/>
......
import React from 'react'
//import axios from 'axios'
// import { response } from 'express'
function LandingPage() {
// useEffect(() => {
// axios.get('/api/hello')
// .then(response => console.log(response.data))
// }, [])
return (
<div>
LandingPage
</div>
)
}
export default LandingPage