Commit 5e028ffa authored by Choi Ga Young's avatar Choi Ga Young
Browse files

Merge remote-tracking branch 'origin/yeonwoo' into young

parents cb575cad a6cc8349
...@@ -49,7 +49,6 @@ function Chat(props) { ...@@ -49,7 +49,6 @@ function Chat(props) {
<Form.Control name='msg' type='text' onChange={handleChange} /> <Form.Control name='msg' type='text' onChange={handleChange} />
<Button variant="primary" type="submit">전송</Button> <Button variant="primary" type="submit">전송</Button>
</Form> </Form>
</div> </div>
......
import React from 'react' import React, { useState, useEffect } from 'react'
import { Navbar, Nav, Button } from 'react-bootstrap'; import { Navbar, Nav, Button } from 'react-bootstrap';
import { Link } from 'react-router-dom'; import { Link } from 'react-router-dom';
import { handleLogout } from '../utils/auth'; import { handleLogout } from '../utils/auth';
import axios from 'axios'
function Menu() { function Menu() {
......
...@@ -14,6 +14,8 @@ import { io } from "socket.io-client"; //모듈 가져오기 ...@@ -14,6 +14,8 @@ import { io } from "socket.io-client"; //모듈 가져오기
const socket = io(); const socket = io();
function Home() { function Home() {
const [username, setUsername] = useState('defaultUser')
const [show, setShow] = useState(false); const [show, setShow] = useState(false);
const [chat, setChat] = useState(false); const [chat, setChat] = useState(false);
......
...@@ -5,10 +5,10 @@ import { Image, Button, Container, Form, FormControl, Navbar, Nav, Row, Col, Dro ...@@ -5,10 +5,10 @@ import { Image, Button, Container, Form, FormControl, Navbar, Nav, Row, Col, Dro
import { BrowserRouter as Router, Route, Redirect, Switch, Link } from 'react-router-dom'; import { BrowserRouter as Router, Route, Redirect, Switch, Link } from 'react-router-dom';
import axios from 'axios' import axios from 'axios'
import userdefault from './KakaoTalk_20201230_153151693.png' import userdefault from '../Images/KakaoTalk_20201230_153151693.png'
import img1 from './img_1.png' import img1 from '../Images/img_1.png'
import img2 from './img_2.png' import img2 from '../Images/img_2.png'
import img3 from './img_3.jpg' import img3 from '../Images/img_3.jpg'
import DropdownItem from 'react-bootstrap/esm/DropdownItem'; import DropdownItem from 'react-bootstrap/esm/DropdownItem';
...@@ -39,7 +39,6 @@ function ProfilePage() { ...@@ -39,7 +39,6 @@ function ProfilePage() {
} else { } else {
setHidden(true) setHidden(true)
} }
console.log(document.cookie)
} }
function handleChange(e) { function handleChange(e) {
setUser({ ...user, 'nickname': e.target.value }) setUser({ ...user, 'nickname': e.target.value })
...@@ -94,27 +93,23 @@ function ProfilePage() { ...@@ -94,27 +93,23 @@ function ProfilePage() {
return ( return (
<div> <div>
<Menu /> <Menu />
<Container> <Container className='border' fluid>
<Row><h1>ProfilePage</h1></Row>
<Row><h2>{user.username} 환영합니다 !</h2></Row>
</Container>
<Container className="mt-5 shadow w-75">
<Row> <Row>
<Col sm={4}> <Col sm={4}>
<Row> <Row className='justify-content-center'>
<div className="d-flex justify-content-center mb-3" id="defaultImg"> <div className="d-flex ml-3 mt-3" id="defaultImg">
<Image src={userimg} width="300px" roundedCircle /> <Image src={userimg} width="300px" roundedCircle />
</div> </div>
</Row> </Row>
<Row> <Row className='ml-3 mt-3 justify-content-center'>
<Form className="d-flex justify-content-center"> <Form className="d-flex">
<Form.Group> <Form.Group>
<div id="image_container"></div> <div id="image_container"></div>
<Form.File label="프로필 사진 변경" accept="image/*" onChange={setThumbnail} /> <Form.File label="프로필 사진 변경" accept="image/*" onChange={setThumbnail} />
</Form.Group> </Form.Group>
</Form> </Form>
</Row> </Row>
<Row className="d-flex justify-content-center"> <Row className="d-flex justify-content-center mb-3">
<Dropdown> <Dropdown>
<Dropdown.Toggle variant='success' id='dropdown-basic'> <Dropdown.Toggle variant='success' id='dropdown-basic'>
프로필 사진 선택 프로필 사진 선택
...@@ -128,34 +123,35 @@ function ProfilePage() { ...@@ -128,34 +123,35 @@ function ProfilePage() {
</Row> </Row>
</Col> </Col>
<Col sm={8}> <Col sm={8}>
<Row className='m-5 justify-content-center'>
<Row className="m-3 justify-content-flex-start" style={{ fontWeight: "bold", fontSize: "x-large" }}> <h2>{user.username}님의 프로필 정보</h2>
<Col sm={2.5}>이름 :</Col>
<Col sm={8}>{user.username}</Col>
</Row> </Row>
<Row className="m-3 justify-content-flex-start" id="nickname"> <Row className="m-3 justify-content-flex-start" style={{ fontWeight: "bold", fontSize: "large" }}>
<Form className="d-flex" onSubmit={handleSubmit} style={{ fontWeight: "bold", fontSize: "x-large" }}> <Col xs={3}>이름 :</Col>
<Col xs={6}>{user.username}</Col>
<Row> {/* <Col sm={4}></Col> */}
<Col>별명 :</Col> </Row>
<Col hidden={!hidden}> <Row className="m-3 justify-content-flex-start" id="nickname" style={{ fontWeight: "bold", fontSize: "large" }}>
<Col xs={3}>별명 :</Col>
<Col xs={6} hidden={!hidden}>
{user.nickname} {user.nickname}
</Col> </Col>
<Col hidden={hidden}> <Col xs={6} hidden={hidden}>
<Form.Control defaultValue={user.nickname} style={{width : "110%"}} onChange={handleChange} /> <Form>
<Form.Control defaultValue={user.nickname} style={{ width: "110%" }} onChange={handleChange} />
</Form>
</Col> </Col>
<Col> <Col xs={3}>
<Form className="d-flex" onSubmit={handleSubmit}>
<Button className="ml-3 d-flex justify-content-end" variant="outline-primary" size="sm" type='submit'>수정</Button> <Button className="ml-3 d-flex justify-content-end" variant="outline-primary" size="sm" type='submit'>수정</Button>
</Col>
</Row>
</Form> </Form>
</Col>
</Row> </Row>
<Row className="m-3" style={{ fontWeight: "bold", fontSize: "x-large" }}> <Row className="m-3" style={{ fontWeight: "bold", fontSize: "large" }}>
<Col sm={2.5}>이메일 : </Col> <Col xs={3}>이메일 : </Col>
<Col sm={8}>{user.email}</Col> <Col xs={6}>{user.email}</Col>
</Row> </Row>
<Row className='justify-content-center'> <Row className='m-3 justify-content-center'>
<Form> <Form>
<Button variant="outline-success" size="sm" className="mr-4" onClick={handleNicksave}>저장</Button> <Button variant="outline-success" size="sm" className="mr-4" onClick={handleNicksave}>저장</Button>
<Link to='/'> <Link to='/'>
...@@ -166,94 +162,6 @@ function ProfilePage() { ...@@ -166,94 +162,6 @@ function ProfilePage() {
</Col> </Col>
</Row> </Row>
</Container> </Container>
<Container className="d-flex justify-content-center">
<div className="mt-5 shadow w-75">
<h1 className="text-center mt-4 ml-5 mr-5 mb-3">Profile Page</h1>
<h4 className="text-center mb-5">{user.username} 환영합니다 !</h4>
<div className="d-flex justify-content-center mb-3" id="defaultImg">
<Image src={userimg} width="300px" roundedCircle />
</div>
<Row className="d-flex justify-content-center">
<Form className="d-flex justify-content-center">
<Form.Group>
<div id="image_container"></div>
<Form.File label="프로필 사진 변경" accept="image/*" onChange={setThumbnail} />
</Form.Group>
</Form>
</Row>
<Row className="d-flex justify-content-center">
<Dropdown>
<Dropdown.Toggle variant='success' id='dropdown-basic'>
프로필 사진 선택
</Dropdown.Toggle>
<Dropdown.Menu>
<Dropdown.Item as='button'>홈으로</Dropdown.Item>
<Dropdown.Item href='/'>라이언</Dropdown.Item>
<Dropdown.Item href='/'>어피치</Dropdown.Item>
</Dropdown.Menu>
</Dropdown>
</Row>
{/* <Carousel className="d-flex justify-content-center" style={{ width: "300px", height: "300px" }}>
<Carousel.Item className="d-flex justify-content-center">
<Image
className="d-block w-100"
src={img1}
/>
<Carousel.Caption>
<p style={{color : 'black'}}>펭수입니다.</p>
</Carousel.Caption>
</Carousel.Item>
<Carousel.Item>
<Image
className="d-block w-100"
src={img2}
/>
<Carousel.Caption>
<p>라이언입니다.</p>
</Carousel.Caption>
</Carousel.Item>
<Carousel.Item>
<Image
className="d-block w-100"
src={img3}
/>
<Carousel.Caption>
<p>어피치 입니다.</p>
</Carousel.Caption>
</Carousel.Item>
</Carousel> */}
<div className="text-center">
<div className="m-3" style={{ fontWeight: "bold", fontSize: "x-large" }}>이름 : {user.username}</div>
<div className="m-3" id="nickname">
<Form className="d-flex justify-content-center" onSubmit={handleSubmit} style={{ fontWeight: "bold", fontSize: "x-large" }}>
별명 :
<div hidden={!hidden}>
{user.nickname}
</div>
<Form.Control defaultValue={user.nickname} style={{ width: "40%" }} size="sm" onChange={handleChange} hidden={hidden} />
<Button className="ml-3" variant="outline-primary" size="sm" type='submit'>수정</Button>
</Form>
</div>
<div className="m-3" style={{ fontWeight: "bold", fontSize: "x-large" }}>이메일 : {user.email}</div>
</div>
<div className="text-center m-5">
<Form>
<Button variant="outline-success" size="sm" className="mr-4" onClick={handleNicksave}>저장</Button>
<Link to='/'>
<Button variant="outline-success" size="sm" className="ml-4" > 화면으로</Button>
</Link>
</Form>
</div>
</div>
</Container>
</div> </div>
) )
} }
......
import Profile from "../models/profile.js"
import bcrypt from "bcryptjs";
import jwt from 'jsonwebtoken'
import config from "../config.js"
const getimage = async (req, res) => {
const defaultimg = 'https://t1.daumcdn.net/cfile/tistory/2761AA4558A05CBE2A'
// const newImg = await new Profile({
// defaultimg
// //required를 하였기 때문에 이중 하나라도 없으면 에러 발생
// }).save()
}
export default { getimage }
\ No newline at end of file
import express from 'express'
import profileCtrl from "../controllers/profile.controller.js";
const router = express.Router()
router.route('/profile')
.get(profileCtrl.getimage)
export default router
\ No newline at end of file
...@@ -2,7 +2,6 @@ import express from 'express' ...@@ -2,7 +2,6 @@ import express from 'express'
import connectDb from './utils/connectDb.js' import connectDb from './utils/connectDb.js'
import userRouter from './routes/user.routes.js' import userRouter from './routes/user.routes.js'
import authRouter from './routes/auth.routes.js' import authRouter from './routes/auth.routes.js'
import profileRouter from './routes/profile.routes.js'
import bodyParser from "body-parser"; import bodyParser from "body-parser";
import http from "http"; import http from "http";
...@@ -47,7 +46,6 @@ app.use(bodyParser.json()); ...@@ -47,7 +46,6 @@ app.use(bodyParser.json());
app.use(userRouter) app.use(userRouter)
app.use(authRouter) app.use(authRouter)
app.use(profileRouter)
//userRouter로 이동 //userRouter로 이동
app.get('/', (req, res) => { app.get('/', (req, res) => {
......
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