Commit 4fdcce9a authored by 우지원's avatar 우지원
Browse files

Merge remote-tracking branch 'origin/sooModalTest' into jiweon827

parents 4feac4b2 e32c9aa7
import React, { useState } from 'react' import React, { useState } from 'react'
import axios from 'axios'; import axios from 'axios';
import { Row, Col, Modal, Button, Form } from 'react-bootstrap'; import { Row, Col, Modal, Button, Form, Alert } from 'react-bootstrap';
import catchErrors from '../utils/catchErrors' import catchErrors from '../utils/catchErrors'
...@@ -13,17 +13,17 @@ function EnterRoom(props) { ...@@ -13,17 +13,17 @@ function EnterRoom(props) {
async function recordEntryLog() { async function recordEntryLog() {
const leaveInfo = { userId: userId, roomCode: enterCode, leaveTime: realTime } const leaveInfo = { userId: userId, roomCode: enterCode, leaveTime: realTime }
try { try {
const check = await axios.get('/room/entrylog', { params: leaveInfo }) const check = await axios.get('/room/entrylog', { params: leaveInfo })
if (check.data) { //있으면 put으로 if (check.data) { //있으면 put으로
await axios.put('/room/entrylog', leaveInfo) await axios.put('/room/entrylog', leaveInfo)
} else { //없으면 post } else { //없으면 post
await axios.post('/room/entrylog', leaveInfo) await axios.post('/room/entrylog', leaveInfo)
} }
} catch (error) { } catch (error) {
catchErrors(error, setError) catchErrors(error, setError)
} }
} }
function handleChange(event) { function handleChange(event) {
const { name, value } = event.target const { name, value } = event.target
...@@ -57,6 +57,9 @@ function EnterRoom(props) { ...@@ -57,6 +57,9 @@ function EnterRoom(props) {
<Modal.Header closeButton> <Modal.Header closeButton>
<Modal.Title>참여 코드로 채팅 참가</Modal.Title> <Modal.Title>참여 코드로 채팅 참가</Modal.Title>
</Modal.Header> </Modal.Header>
{error && <Alert variant='danger'>
{error}
</Alert>}
<Modal.Body> <Modal.Body>
<Form onSubmit={handleSubmit}> <Form onSubmit={handleSubmit}>
<Form.Group as={Row} controlId="formCodeE"> <Form.Group as={Row} controlId="formCodeE">
...@@ -67,7 +70,7 @@ function EnterRoom(props) { ...@@ -67,7 +70,7 @@ function EnterRoom(props) {
</Form.Group> </Form.Group>
<Form.Group as={Row}> <Form.Group as={Row}>
<Col sm={{ span: 5, offset: 4 }}> <Col sm={{ span: 5, offset: 4 }}>
<Button type="submit" style={{backgroundColor:"#9174ad", borderColor:"#9174ad"}} >참가</Button> <Button type="submit" style={{ backgroundColor: "#9174ad", borderColor: "#9174ad" }} >참가</Button>
</Col> </Col>
</Form.Group> </Form.Group>
</Form> </Form>
......
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