Commit b00d28ed authored by seoyeon's avatar seoyeon
Browse files

Merge remote-tracking branch 'origin/jaeyeoniiiiii' into seoyeon2

parents a8d320fd ba9594d3
...@@ -5,9 +5,7 @@ const AddRoom = () => { ...@@ -5,9 +5,7 @@ const AddRoom = () => {
return ( return (
<div> <div>
<div className="mx-4 my-3 d-flex justify-content-between"> <div className="mx-4 my-3 d-flex justify-content-between">
<div className="fs-4"> <div className="fs-4">참여중인 방목록</div>
참여중인 방목록
</div>
<button <button
type="button" type="button"
className="py-1 px-2" className="py-1 px-2"
...@@ -45,7 +43,6 @@ const AddRoom = () => { ...@@ -45,7 +43,6 @@ const AddRoom = () => {
className="p-3" className="p-3"
data-bs-toggle="modal" data-bs-toggle="modal"
data-bs-target="#joinModal" data-bs-target="#joinModal"
// data-bs-dismiss="modal"
style={{ style={{
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
...@@ -54,7 +51,8 @@ const AddRoom = () => { ...@@ -54,7 +51,8 @@ const AddRoom = () => {
backgroundColor: "#E0CEE8", backgroundColor: "#E0CEE8",
borderColor: "#E0CEE8", borderColor: "#E0CEE8",
}} }}
>방참여하기 >
방참여하기
</button> </button>
<div <div
className="modal fade" className="modal fade"
...@@ -74,7 +72,6 @@ const AddRoom = () => { ...@@ -74,7 +72,6 @@ const AddRoom = () => {
className="p-3" className="p-3"
data-bs-toggle="modal" data-bs-toggle="modal"
data-bs-target="#makeModal" data-bs-target="#makeModal"
// data-bs-dismiss="modal"
style={{ style={{
display: "flex", display: "flex",
flexDirection: "column", flexDirection: "column",
...@@ -83,7 +80,8 @@ const AddRoom = () => { ...@@ -83,7 +80,8 @@ const AddRoom = () => {
backgroundColor: "#f5cfe3", backgroundColor: "#f5cfe3",
borderColor: "#f5cfe3", borderColor: "#f5cfe3",
}} }}
>방생성하기 >
방생성하기
</button> </button>
<div <div
className="modal fade" className="modal fade"
......
...@@ -23,17 +23,14 @@ const CreateRoom = () => { ...@@ -23,17 +23,14 @@ const CreateRoom = () => {
}, [room]); }, [room]);
function handleChange(event) { function handleChange(event) {
// console.log(room)
const { name, value } = event.target const { name, value } = event.target
setRoom({ ...room, [name]: value }) setRoom({ ...room, [name]: value })
} }
async function handleSubmit(e) { async function handleSubmit(e) {
e.preventDefault() e.preventDefault()
// console.log('룸룸', room)
try { try {
const res = await roomApi.create(room) const res = await roomApi.create(room)
// console.log(res)
const Id = res.id const Id = res.id
console.log(Id) console.log(Id)
alert(`방참여코드는 ${Id}입니다`) alert(`방참여코드는 ${Id}입니다`)
......
...@@ -6,28 +6,27 @@ import catchErrors from "../../context/catchError"; ...@@ -6,28 +6,27 @@ import catchErrors from "../../context/catchError";
const userprofile = localStorage.getItem("user"); const userprofile = localStorage.getItem("user");
const INIT_USER = { const INIT_USER = {
id: userprofile, id: userprofile,
email: '', email: "",
img: '', img: "",
} };
const HomeProfile = () => { const HomeProfile = () => {
const [user, setUser] = useState(INIT_USER) const [user, setUser] = useState(INIT_USER);
const [error, setError]= useState("");
async function getSetUser(userID) { async function getSetUser(userID) {
try { try {
// console.log('userID', userID) const data = await userApi.getUser(userID);
const data = await userApi.getUser(userID)
// console.log(data) setUser(data);
setUser(data)
// console.log(user)
} catch (error) { } catch (error) {
// catchErrors(error, setError) catchErrors(error, setError);
} }
} }
useEffect(() => { useEffect(() => {
getSetUser(userprofile) getSetUser(userprofile);
}, [userprofile]) }, [userprofile]);
return ( return (
<Link to={`/profile/${user.id}`} className="text-decoration-none text-dark"> <Link to={`/profile/${user.id}`} className="text-decoration-none text-dark">
...@@ -40,7 +39,6 @@ const HomeProfile = () => { ...@@ -40,7 +39,6 @@ const HomeProfile = () => {
width: "157px", width: "157px",
height: "157px", height: "157px",
}} }}
// value={user.img}
/> />
</div> </div>
<h1 className="d-flex justify-content-center"> {user.email} </h1> <h1 className="d-flex justify-content-center"> {user.email} </h1>
......
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import { Redirect } from "react-router-dom"; import { Redirect } from "react-router-dom";
import roomApi from "../../apis/room.api"; import roomApi from "../../apis/room.api";
import catchErrors from "../../context/catchError";
const userId = localStorage.getItem('user'); const userId = localStorage.getItem("user");
const JoinRoom = () => { const JoinRoom = () => {
const [roomId, setRoomId] = useState(''); const [roomId, setRoomId] = useState("");
const [disabled, setDisabled] = useState(true); const [disabled, setDisabled] = useState(true);
const [error, setError] = useState(""); const [error, setError] = useState("");
const [success, setSuccess] = useState(false); const [success, setSuccess] = useState(false);
...@@ -18,21 +19,17 @@ const JoinRoom = () => { ...@@ -18,21 +19,17 @@ const JoinRoom = () => {
function handleChange(event) { function handleChange(event) {
const { value } = event.target; const { value } = event.target;
setRoomId(value); setRoomId(value);
// console.log(roomId);
} }
async function handleSubmit(e) { async function handleSubmit(e) {
e.preventDefault(); e.preventDefault();
try { try {
// setLoading(true); // setLoading(true);
// setError(""); setError("");
// console.log('userId:', userId)
// console.log('roomId:', roomId)
const data = await roomApi.join({ userId: userId, roomId: roomId }); const data = await roomApi.join({ userId: userId, roomId: roomId });
// console.log(data);
setSuccess(true); setSuccess(true);
} catch (error) { } catch (error) {
// catchErrors(error, setError); catchErrors(error, setError);
} finally { } finally {
// setLoading(false); // setLoading(false);
} }
...@@ -45,7 +42,9 @@ const JoinRoom = () => { ...@@ -45,7 +42,9 @@ const JoinRoom = () => {
<div className="modal-content"> <div className="modal-content">
<form onSubmit={handleSubmit}> <form onSubmit={handleSubmit}>
<div className="modal-header"> <div className="modal-header">
<div className="modal-title" id="joinModal">방참여하기</div> <div className="modal-title" id="joinModal">
방참여하기
</div>
<button <button
type="button" type="button"
className="btn-close" className="btn-close"
......
import userApi from "../../apis/user.api"; import userApi from "../../apis/user.api";
import { useEffect, useState } from "react"; import { useEffect, useState } from "react";
import catchErrors from "../../context/catchError";
const userprofile = localStorage.getItem("user"); const userprofile = localStorage.getItem("user");
const INIT_PROFILE = { const INIT_PROFILE = {
...@@ -11,12 +12,15 @@ const INIT_PROFILE = { ...@@ -11,12 +12,15 @@ const INIT_PROFILE = {
const Info = () => { const Info = () => {
const [profile, setProfile] = useState(INIT_PROFILE); const [profile, setProfile] = useState(INIT_PROFILE);
const [error, setError]= useState("");
async function getProfile(userID) { async function getProfile(userID) {
try { try {
const data = await userApi.getUser(userID); const data = await userApi.getUser(userID);
setProfile(data); setProfile(data);
} catch (error) {} } catch (error) {
catchErrors(error, setError);
}
} }
useEffect(() => { useEffect(() => {
getProfile(userprofile); getProfile(userprofile);
......
import { Link, useParams } from "react-router-dom"; import { Link, useParams } from "react-router-dom";
import React, { useEffect, useState } from "react"; import React, { useEffect, useState } from "react";
import userApi from "../../apis/user.api"; import userApi from "../../apis/user.api";
import catchErrors from "../../context/catchError";
const userprofile = localStorage.getItem("user"); const userprofile = localStorage.getItem("user");
const INIT_PROFILE = { const INIT_PROFILE = {
...@@ -16,12 +17,15 @@ const InfoUpdate = () => { ...@@ -16,12 +17,15 @@ const InfoUpdate = () => {
const [profile, setProfile] = useState(INIT_PROFILE); const [profile, setProfile] = useState(INIT_PROFILE);
const [error,setError]=useState("");
async function getProfile(userID) { async function getProfile(userID) {
try { try {
const data = await userApi.getUser(userID); const data = await userApi.getUser(userID);
setProfile(data); setProfile(data);
} catch (error) {} } catch (error) {
catchErrors(error, setError);
}
} }
useEffect(() => { useEffect(() => {
...@@ -39,7 +43,9 @@ const InfoUpdate = () => { ...@@ -39,7 +43,9 @@ const InfoUpdate = () => {
setProfile({...profile, img:res}) setProfile({...profile, img:res})
}else{ }else{
setProfile() setProfile()
} } catch (error) {} } } catch (error) {
catchErrors(error, setError);
}
}; };
const changeinfo = async (event) => { const changeinfo = async (event) => {
......
import { Link, useParams } from "react-router-dom"; import { Link, useParams } from "react-router-dom";
import { useState, useEffect } from "react"; import { useState, useEffect } from "react";
import userApi from "../../apis/user.api"; import userApi from "../../apis/user.api";
import catchErrors from "../../context/catchError";
const userprofile = localStorage.getItem("user"); const userprofile = localStorage.getItem("user");
const INIT_PROFILE = { const INIT_PROFILE = {
...@@ -11,13 +11,15 @@ const INIT_PROFILE = { ...@@ -11,13 +11,15 @@ const INIT_PROFILE = {
const Profile = () => { const Profile = () => {
const [profile, setProfile] = useState(INIT_PROFILE); const [profile, setProfile] = useState(INIT_PROFILE);
const [error,setError]= useState("");
async function getProfile(userID) { async function getProfile(userID) {
try { try {
const data = await userApi.getUser(userID); const data = await userApi.getUser(userID);
setProfile(data.img) setProfile(data.img)
} catch (error) {} } catch (error) {
catchErrors(error, setError);
}
} }
useEffect(() => { useEffect(() => {
getProfile(userprofile); getProfile(userprofile);
......
...@@ -27,7 +27,7 @@ const UserModel = (sequelize) => { ...@@ -27,7 +27,7 @@ const UserModel = (sequelize) => {
}, },
img: { img: {
type: DataTypes.STRING, type: DataTypes.STRING,
// defaultValue: img defaultValue:'defaultimg'
}, },
roomNumber: { roomNumber: {
type: DataTypes.ARRAY(DataTypes.STRING), type: DataTypes.ARRAY(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