Commit 16fe890c authored by 이재연's avatar 이재연
Browse files

aaa

parent e7e4fea9
...@@ -16,7 +16,19 @@ function App() { ...@@ -16,7 +16,19 @@ function App() {
<Route exact path="/user" component={HomeUserPage} /> <Route exact path="/user" component={HomeUserPage} />
<Route path="/profile/:id/update" component={InfoUpdatePage} /> <Route path="/profile/:id/update" component={InfoUpdatePage} />
<Route path="/profile/:id" component={ProfilePage} /> <Route path="/profile/:id" component={ProfilePage} />
<Route path="/room/:roomId/:channelId" component={RoomPage} /> <Route path="/room/:roomId/:channelId" component={RoomPage}>
{/* <Switch>
<Route path={"/room/:roomId/meeting"}>
<></>
</Route>
<Route path={"/room/:roomId/normal"}>
<></>
</Route>
<Route path={"/room/:roomId/notice"}>
<></>
</Route>
</Switch> */}
</Route>
<Route path="/room/Invite" component={InvitePage} /> <Route path="/room/Invite" component={InvitePage} />
</Switch> </Switch>
{/* </AuthProvider> */} {/* </AuthProvider> */}
......
import axios from "axios"; import axios from "axios";
const getUser = async (id) => { const getUser = async (id) => {
// console.log('id222:',id.userID)
const { data } = await axios.get(`/api/getUser/${id}`); const { data } = await axios.get(`/api/getUser/${id}`);
return data; return data;
}; };
......
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { Redirect } from "react-router-dom"; import { Redirect, useParams } from "react-router-dom";
import roomApi from "../../apis/room.api"; import roomApi from "../../apis/room.api";
import catchErrors from "../../context/catchError"; import catchErrors from "../../context/catchError";
...@@ -45,7 +45,7 @@ const CreateRoom = () => { ...@@ -45,7 +45,7 @@ const CreateRoom = () => {
if (success) { if (success) {
console.log('success', success) console.log('success', success)
alert('룸생성이 완료되었습니다!') alert('룸생성이 완료되었습니다!')
return <Redirect to='/user' /> return <Redirect to="/user"/>
} }
const { name, owner, member, profileimg } = room; const { name, owner, member, profileimg } = room;
......
...@@ -8,15 +8,13 @@ const RoomSingle = () => { ...@@ -8,15 +8,13 @@ const RoomSingle = () => {
const [room, setRoom] = useState([]) const [room, setRoom] = useState([])
const id = localStorage.getItem('user'); const id = localStorage.getItem('user');
const channelId = 1 const channelId = 1
const A = []
// async function getJoinRoom(Id) { // async function getJoinRoom(Id) {
// try { // try {
// console.log('id:',id) // const user = await userApi.getUser({id: Id})
// const User = await userApi.getUser({id: Id}) // console.log('User1:',user)
// console.log('User1:',User) // console.log('User2:',user.roomNumber)
// console.log('User2:',User.roomNumber) // const RoomNumArr = user.roomNumber
// const RoomNumArr = User.roomNumber
// console.log('setRoomNum:',RoomNumArr) // console.log('setRoomNum:',RoomNumArr)
// const Room = await roomApi.getRoom(RoomNumArr) // const Room = await roomApi.getRoom(RoomNumArr)
// } catch (error) { // } catch (error) {
......
import { Link, Route, Switch, useParams } from "react-router-dom";
const ChannelSingle = () => { const ChannelSingle = () => {
const { roomId } = useParams();
return ( return (
<div className="overflow-auto" style={{ height: '610px' }}> <div className="overflow-auto" style={{ height: "610px" }}>
<div className="mb-3"> <div className="mb-3">
<div className="m-3 p-1 row" style={{ backgroundColor: '#E0CEE8' }}> <div className="m-3 p-1 row" style={{ backgroundColor: "#E0CEE8" }}>
<img <Link to={`${roomId}/meeting`}>
className="col-auto mt-2" <img
src="/fullSpeaker.png" className="col-auto mt-2"
width="25px" src="/fullSpeaker.png"
height="25px" width="25px"
/> height="25px"
<h5 className="col mt-2">회의</h5> />
</div> <h5 className="col mt-2" style={{ color: "black" }}>
<ul className="mx-5" style={{ color: '#76D079' }}> 회의
<li> </h5>
<p style={{ color: 'black' }}>CHERRY</p> </Link>
</li>
<li>
<p style={{ color: 'black' }}>JAEYEON</p>
</li>
<li>
<p style={{ color: 'black' }}>SEOYEON</p>
</li>
<li>
<p style={{ color: 'black' }}>JIWEON</p>
</li>
<li>
<p style={{ color: 'black' }}>BYOUNGYUN</p>
</li>
</ul>
</div>
<div className="mb-3">
<div className="m-3 p-1 row" style={{ backgroundColor: '#E0CEE8' }}>
<img
className="col-auto mt-2"
src="/emptySpeaker.png"
width="25px"
height="25px"
/>
<h5 className="col mt-2">사담</h5>
</div> </div>
<ul className="mx-5" style={{ color: '#76D079' }}> <ul className="mx-5" style={{ color: "#76D079" }}>
<li> <li>
<p style={{ color: 'black' }}>CHERRY</p> <p style={{ color: "black" }}>CHERRY</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>JAEYEON</p> <p style={{ color: "black" }}>JAEYEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>SEOYEON</p> <p style={{ color: "black" }}>SEOYEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>JIWEON</p> <p style={{ color: "black" }}>JIWEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>BYOUNGYUN</p> <p style={{ color: "black" }}>BYOUNGYUN</p>
</li> </li>
</ul> </ul>
</div> </div>
<div className="mb-3"> <div className="mb-3">
<div className="m-3 p-1 row" style={{ backgroundColor: '#E0CEE8' }}> <div className="m-3 p-1 row" style={{ backgroundColor: "#E0CEE8" }}>
<img <img
className="col-auto mt-2" className="col-auto mt-2"
src="/emptySpeaker.png" src="/emptySpeaker.png"
width="25px" width="25px"
height="25px" height="25px"
/> />
<h5 className="col mt-2">일반</h5> <Link to={`${roomId}/normal`}>
<h5 className="col mt-2" style={{ color: "black" }}>
일반
</h5>
</Link>
</div> </div>
<ul className="mx-5" style={{ color: '#76D079' }}> <ul className="mx-5" style={{ color: "#76D079" }}>
<li> <li>
<p style={{ color: 'black' }}>CHERRY</p> <p style={{ color: "black" }}>CHERRY</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>JAEYEON</p> <p style={{ color: "black" }}>JAEYEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>SEOYEON</p> <p style={{ color: "black" }}>SEOYEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>JIWEON</p> <p style={{ color: "black" }}>JIWEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>BYOUNGYUN</p> <p style={{ color: "black" }}>BYOUNGYUN</p>
</li> </li>
</ul> </ul>
</div> </div>
<div className="mb-3"> <div className="mb-3">
<div className="m-3 p-1 row" style={{ backgroundColor: '#E0CEE8' }}> <div className="m-3 p-1 row" style={{ backgroundColor: "#E0CEE8" }}>
<img <img
className="col-auto mt-2" className="col-auto mt-2"
src="/emptySpeaker.png" src="/emptySpeaker.png"
width="25px" width="25px"
height="25px" height="25px"
/> />
<h5 className="col mt-2">공지</h5> <Link to={`${roomId}/notice`}>
<h5 className="col mt-2" style={{ color: "black" }}>
공지
</h5>
</Link>
</div> </div>
<ul className="mx-5" style={{ color: '#76D079' }}> <ul className="mx-5" style={{ color: "#76D079" }}>
<li> <li>
<p style={{ color: 'black' }}>CHERRY</p> <p style={{ color: "black" }}>CHERRY</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>JAEYEON</p> <p style={{ color: "black" }}>JAEYEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>SEOYEON</p> <p style={{ color: "black" }}>SEOYEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>JIWEON</p> <p style={{ color: "black" }}>JIWEON</p>
</li> </li>
<li> <li>
<p style={{ color: 'black' }}>BYOUNGYUN</p> <p style={{ color: "black" }}>BYOUNGYUN</p>
</li> </li>
</ul> </ul>
</div> </div>
</div> </div>
) );
} };
export default ChannelSingle export default ChannelSingle;
...@@ -2,12 +2,10 @@ import axios from "axios"; ...@@ -2,12 +2,10 @@ import axios from "axios";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { Redirect } from "react-router-dom"; import { Redirect } from "react-router-dom";
import userApi from "../apis/user.api"; import userApi from "../apis/user.api";
// import catchErrors from "../context/catchError"; import catchErrors from "../context/catchError";
// import auth from "../context/auth_context" // import auth from "../context/auth_context"
const INIT_USER = { const INIT_USER = {
name: "", name: "",
idNumber1: "",
idNumber2: "",
email: "", email: "",
password: "", password: "",
checkpw: "", checkpw: "",
...@@ -19,51 +17,46 @@ const Signup = () => { ...@@ -19,51 +17,46 @@ const Signup = () => {
const [error, setError] = useState(""); const [error, setError] = useState("");
const [disabled, setDisabled] = useState(false); const [disabled, setDisabled] = useState(false);
const [success, setSuccess] = useState(false); const [success, setSuccess] = useState(false);
const [loading, setLoading] = useState(false);
useEffect(() => { useEffect(() => {
setDisabled( setDisabled(!(user.name && user.email && user.password && user.checkpw));
!(
user.name &&
user.idNumber1 &&
user.idNumber2 &&
user.email &&
user.password &&
user.checkpw
)
);
}, [user]); }, [user]);
function handleChange(event) { function handleChange(event) {
const { name, value } = event.target; const { name, value } = event.target;
setUser({ ...user, [name]: value }); setUser({ ...user, [name]: value });
// console.log(user);
} }
async function handleSubmit() { async function handleSubmit() {
try { try {
const data = await userApi.signup(user) const data = await userApi.signup(user);
// const data = await axios.post("https://localhost:8080/api/room/1/1",user) console.log(data)
setLoading(true);
setError("");
// const success = await login(user.email, user.password);
// const data = await axios.post("/api/room/1/1",user)
console.log(data);
setSuccess(true); setSuccess(true);
setError("");
} catch (error) { } catch (error) {
// catchErrors(error, setError); catchErrors(error, setError);
} finally { } finally {
setLoading(false); // setLoading(false);
}
}
function checkPassword(event) {
const p1 = user.password;
const p2 = user.checkpw;
if (p1 !== p2) {
event.preventDefault();
alert("비밀번호가 일치하지 않습니다.");
return false;
} else {
setSuccess(true);
return true;
} }
} }
if (success) { if (success) {
alert('회원가입 되었습니다.') alert("회원가입 되었습니다.");
return <Redirect to="/" />; <Redirect to="/" />;
} }
const { name, id, password, checkpw, phone } = user;
const { name, idNumber1, idNumber2, id, password, checkpw, phone } = user;
return ( return (
<div className="modal-content"> <div className="modal-content">
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
...@@ -91,38 +84,6 @@ const Signup = () => { ...@@ -91,38 +84,6 @@ const Signup = () => {
onChange={handleChange} onChange={handleChange}
/> />
</div> </div>
<div className="p-2">
<label className="p-1">주민등록번호</label>
<div className="d-flex text-center">
<div className="col-4">
<input
className="mt-2 form-control"
id="idNumber1"
type="text"
name="idNumber1"
placeholder="●●●●●●"
maxLength='6'
value={idNumber1}
onChange={handleChange}
/>
</div>
<div className="col-1 pt-3 ps-2"></div>
<div className="col-1">
<input
className="mt-2 ms-2 form-control"
id="idNumber2"
type="text"
style={{width:'35px'}}
name="idNumber2"
placeholder=""
value={idNumber2}
onChange={handleChange}
maxLength='1'
/>
</div>
<div className="pt-3 ps-4">* * * * * *</div>
</div>
</div>
<div className="p-2"> <div className="p-2">
<label className="p-1">아이디</label> <label className="p-1">아이디</label>
<input <input
...@@ -174,7 +135,12 @@ const Signup = () => { ...@@ -174,7 +135,12 @@ const Signup = () => {
</div> </div>
{console.log(disabled)} {console.log(disabled)}
<div className="modal-footer"> <div className="modal-footer">
<button type="submit" className="btn btn-primary" disabled={disabled}> <button
type="submit"
className="btn btn-primary"
onClick={checkPassword}
disabled={disabled}
>
회원가입 회원가입
</button> </button>
</div> </div>
......
...@@ -18,8 +18,8 @@ const UserModel = (sequelize) => { ...@@ -18,8 +18,8 @@ const UserModel = (sequelize) => {
password: { password: {
type: DataTypes.STRING, type: DataTypes.STRING,
}, },
gender: { checkpw:{
type: DataTypes.INTEGER, type: DataTypes.STRING,
}, },
phone: { phone: {
type: DataTypes.STRING, type: DataTypes.STRING,
......
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