Commit 74f2c338 authored by kusang96's avatar kusang96
Browse files

dd

parent 4815e070
......@@ -5,7 +5,6 @@ import Pagination from '../Components/Pagination';
import axios from 'axios';
import catchError from '../utils/catchErrors';
import { isAuthenticated } from '../utils/auth';
import catchError from '../utils/catchErrors';
import { Container, Row, Col, Form, FormControl, Button, Dropdown } from 'react-bootstrap';
function ProductsList({ match }) {
......
import axios from "axios";
export function handleLogin({ userId, role, name }) {
export function handleLogin({ userId, role, name, tel }) {
localStorage.setItem('id', userId)
localStorage.setItem('role', role)
localStorage.setItem('name', name)
localStorage.setItem('tel', tel)
}
export async function handleLogout() {
localStorage.removeItem('id')
localStorage.removeItem('role')
localStorage.removeItem('name')
localStorage.clear()
await axios.get('/api/auth/logout')
window.location.href = '/'
}
......
......@@ -7,7 +7,7 @@ const login = async (req, res) => {
const { id, password } = req.body
console.log(id, password)
try {
const user = await User.findOne({ id }).select('password role name')
const user = await User.findOne({ id }).select('password role name tel')
console.log('u=', user)
if (!user) {
return res.status(404).send(`${id}가 존재하지 않습니다.`)
......@@ -23,7 +23,7 @@ const login = async (req, res) => {
httpOnly: true,
secure: config.env === 'production'
})
res.json({ userId: user._id, role: user.role, name: user.name })
res.json({ userId: user._id, role: user.role, name: user.name, tel: user.tel })
} else {
res.status(401).send('비밀번호가 일치하지 않습니다.')
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment