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

aaa

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