Skip to content

Commit 51ea9c4

Browse files
committed
feat: #16 주석 삭제
1 parent 19f7c20 commit 51ea9c4

File tree

11 files changed

+10
-90
lines changed

11 files changed

+10
-90
lines changed

src/components/CustomerRegister/RegisterInput.tsx

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,6 @@ export default function RegisterInput() {
1919
console.log(token)
2020
}
2121

22-
//
23-
// const customerRegister =()=>{
24-
// //axios.post(url : post가 연결되어야 할 api주소, data : 백엔드에서 정의한 request body).then(앞 코드가 정상작동하면 실행되는 다음 행위)
25-
// axios.post('http://localhost:8000/api/v1/waitings/',{
26-
// store_id: localStorage.getItem('store_id'),
27-
// people: people,
28-
// token: 'token'})
29-
// .then((res) => console.log(res)) //(setItem) 로컬스토리지에 res.data.store_id를 "id"로 저장하는 코드,
30-
// // res는 사용자 마음대로 정의, res.data.store_id는 백엔드에서 받아온 response body
31-
// }
3222

3323
return (
3424
<div>

src/components/StoreRegister/StoreRegisterInput.tsx

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,6 @@ import {Link, useNavigate} from "react-router-dom";
66
// import StoreLocation from "./StoreLocation";
77
import axios from 'axios';
88

9-
// declare global {
10-
// interface Window {
11-
// kakao: any;
12-
// }
13-
// }
14-
15-
// function A {
16-
// latitude:
17-
// }
189

1910
export default function RegisterInput() {
2011
const [name, setName] = useState('')
@@ -42,7 +33,6 @@ export default function RegisterInput() {
4233
}
4334

4435
const storeRegister =()=>{
45-
//axios.post(url : post가 연결되어야 할 api주소, data : 백엔드에서 정의한 request body).then(앞 코드가 정상작동하면 실행되는 다음 행위)
4636
axios.post('http://15.164.28.246:8000/api/v1/stores/signup/',{
4737
name: name,
4838
phone_num: phone_num,
@@ -59,7 +49,6 @@ export default function RegisterInput() {
5949
navigate("/WaitingList")
6050
})
6151
}
62-
//console.log(localStorage.getItem("id")) 로컬스토리지에서 저장되어있는 값을 꺼내와서 console.log에 출력해서 확인하는 코드(getItem)
6352

6453
return (
6554
<div>

src/components/WaitingList/ListTable.tsx

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -47,12 +47,10 @@ const columns: readonly Column[] = [
4747
},
4848
];
4949

50-
export default function ListTable({waiting ,setTemp}:{waiting:waitings[]|undefined; setTemp:React.Dispatch<React.SetStateAction<res | undefined>>}) { //, {temp}
51-
//const [temp, setTemp] = useState<res>();
50+
export default function ListTable({waiting ,setTemp}:{waiting:waitings[]|undefined; setTemp:React.Dispatch<React.SetStateAction<res | undefined>>}) {
5251
let abc: number;
5352
const [page, setPage] = React.useState(0);
5453
const [rowsPerPage, setRowsPerPage] = React.useState(5);
55-
//const [rows, setRows] = React.useState<waitings[]|undefined>(waiting);
5654

5755
const handleChangePage = (event: unknown, newPage: number) => {
5856
setPage(newPage)
@@ -91,10 +89,7 @@ export default function ListTable({waiting ,setTemp}:{waiting:waitings[]|undefin
9189
}
9290
)
9391
.then((response) => {
94-
// console.log("durlghkrdls")
95-
// console.log(response);
9692
console.log('[입장완료]' + localStorage.getItem('accessToken'))
97-
9893
})
9994
.catch((error) => {
10095
console.log('Error!');
@@ -104,8 +99,6 @@ export default function ListTable({waiting ,setTemp}:{waiting:waitings[]|undefin
10499
//대기목록 MUI 안에 있는 대기취소 버튼
105100
const waitingCancel = (index: number) => {
106101
if(waiting != undefined) {
107-
// console.log(waiting[index]); //배열(?) 확인용
108-
// console.log(waiting[index].waiting_id);
109102
axios.patch<res>('http://15.164.28.246:8000/api/v1/stores/cancellations/',{
110103
waiting_id: waiting[index].waiting_id
111104
},
@@ -114,11 +107,8 @@ export default function ListTable({waiting ,setTemp}:{waiting:waitings[]|undefin
114107
}
115108
)
116109
.then((response) => {
117-
//민아) 뭐가 다른지 확인
118-
// console.log(response); //차이ㅏㄱ 뭔가??
119-
// console.log(response.data)
120-
//console.log(response.data); // 최신 상태 배열
121-
// setTemp(pre => ({...pre,waiting:[...response.data.waiting]}));
110+
//민아) 행 삭제 시도
111+
// setTemp(pre => ({...pre,waiting:[...response.data.waiting]}));
122112
console.log('[대기강제취소]' + localStorage.getItem('accessToken'))
123113
})
124114
.catch((error) => {
@@ -127,8 +117,7 @@ export default function ListTable({waiting ,setTemp}:{waiting:waitings[]|undefin
127117
}}
128118

129119

130-
131-
120+
132121
return (
133122
<Paper className='tableStyle'>
134123
<TableContainer sx={{ maxHeight: 500 }}>
@@ -176,7 +165,6 @@ export default function ListTable({waiting ,setTemp}:{waiting:waitings[]|undefin
176165
);
177166
})}
178167
<TableCell onClick={() => Call()} align="center"><IconButton><NotificationsActiveIcon color="warning"/></IconButton></TableCell>
179-
{/* waiting_id 대신 index를 넣어줘야 waiting_id가 6, 7 일 때 배열 값과 달라서 발생하는 에러를 해결할 수 있음 */}
180168
<TableCell onClick={() => Start(index)} align="center"><IconButton><CheckCircleIcon color="success"/></IconButton></TableCell>
181169
<TableCell onClick={() => waitingCancel(index)} align="center"><IconButton><CancelIcon color="error"/></IconButton></TableCell>
182170
</TableRow>
@@ -198,11 +186,6 @@ export default function ListTable({waiting ,setTemp}:{waiting:waitings[]|undefin
198186
</Paper>
199187
);
200188
}
201-
// 파일에서 command+shift+f로 검색
202-
// TablePagination의 count가 undefined,count에서 waiting을 못 읽었어!,
203-
// 왜냐면 useEffect가 실행되기 전 컴포넌트(waiting={temp?.data})가 먼저 실행됐기 때문에 undefined 상태,
204-
// undefined상태에서 waiting을 slice 등을 해주라고 하니까 오류가 발생한 거야
205-
// 오류를 해결하기 위해서 undefined일 때 waiting을 빈 배열로 만들어 줘서 초기값을 만들어준겨
206189

207190
ListTable.defaultProps = {
208191
waiting:[]

src/components/WaitingList/StoreInformation.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,12 @@ interface Props {
99
//type Info = {text : string}
1010

1111
function StoreInformation(information: Props) {
12-
//const [text, setText] = useState<string>({setInformation})
1312
const onChange = (event: any) => (
1413
setInfo(event.target.value)
1514
);
1615

17-
const [info, setInfo] = useState(information); //useState('information'); 이렇게 작성되면 텍스트 information만 작성되던데 이게 맞는지!
18-
16+
const [info, setInfo] = useState(information);
17+
1918
const storeInformationText = () => {
2019
axios.patch('http://15.164.28.246:8000/api/v1/stores/details/',{
2120
information: info

src/components/WaitingList/SubButton.tsx

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import axios from "axios";
88

99
function SubButton() {
1010

11-
const [is_waiting, setIs_waiting] = useState(true); // 로그인 하고 받은 스토어 아이디 가지고 조회해서 이즈웨이팅 값 넣기
11+
const [is_waiting, setIs_waiting] = useState(true);
1212
const iswaitingChange = () => {
1313
axios.patch('http://15.164.28.246:8000/api/v1/stores/breaktimes/',{
1414
},
@@ -28,22 +28,10 @@ function SubButton() {
2828
return (
2929
<Container>
3030
<div id = "wrap">
31-
{/* <Link to="/customerRegister"
32-
style={{ textDecoration: "none" }}>
33-
<button className='offlineRegisterButton'>
34-
NEW
35-
</button>
36-
</Link>
37-
<div className='offlineRegisterText'>
38-
현장 등록
39-
</div> */}
4031
<br/>
4132
<button onClick={iswaitingChange} className={`stopRegisterButton ${is_waiting ? 'closeBg' : 'openBg'}`} >
4233
{is_waiting ? '대기 마감' : '대기 시작'}
4334
</button>
44-
{/* <div className=' stopRegisterText'>
45-
{is_waiting ? '대기 마감' : '대기 시작'}
46-
</div> */}
4735
</div>
4836
</Container>
4937
);

src/components/WaitingList/TableTitle.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ function TableTitle() {
88
<Container>
99
<div id = "wrap">
1010
<br/>
11-
{/* <div className='tableTitleLineTop'></div> */}
1211
<div className='tableTitle'>
1312
대기 목록
1413
</div>
15-
{/* <div className='tableTitleLineBottom'></div> */}
1614
</div>
1715
</Container>
1816
);

src/components/WaitingList/WaitingList.scss

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
width: 89.7%;
55
height: 500;
66
overflow: 'hidden';
7-
//font-family: 'BMJUA';
87
}
98

109
.tableOutline {
@@ -22,7 +21,6 @@
2221
margin-bottom: 1em;
2322
width: 22.5em;
2423
height: 1em;
25-
//padding: 0.5em;
2624
color: black;
2725
background-color: #FEFBDC;
2826
border-color: #FBE5AD;
@@ -59,10 +57,8 @@
5957
font-family: 'BMJUA';
6058
font-size: 2em;
6159
border-radius: 2em;
62-
//display: flex;
6360
align-items: center;
6461
justify-content: center;
65-
//float: 'left';
6662
}
6763

6864
.offlineRegisterText{
@@ -79,7 +75,6 @@
7975
}
8076

8177
.stopRegisterButton{
82-
//margin-top: 1.1em;
8378
margin-left: 24em;
8479
width: 5em;
8580
height: 2em;
@@ -89,10 +84,7 @@
8984
font-family: 'BMJUA';
9085
font-size: 1.5em;
9186
border-radius: 10px;
92-
//display: flex;
93-
//align-items: center;
9487
justify-content: center;
95-
//float: 'left';
9688
}
9789

9890
.stopRegisterText{
@@ -113,6 +105,4 @@
113105
}
114106
.openBg{
115107
background-color: rgb(203, 255, 90);
116-
//background-color: #b3fd43;
117-
118108
}

src/pages/CustomerRegister/CustomerRegister.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ function CustomerRegister() {
1212
</div>);
1313
}
1414

15-
export default CustomerRegister; //import를 하기 위해선 export(내보내기)를 해야 한다
15+
export default CustomerRegister;

src/pages/Login/Login.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
import axios from "axios";
88
import { access } from "fs";
99

10-
// 로그인, response body - access, refresh
1110

1211
function Login() {
1312
document.body.style.backgroundColor = "#FFFBD9";
@@ -18,7 +17,6 @@ function Login() {
1817
const navigate = useNavigate();
1918

2019
const storeLogin =()=>{
21-
//axios.post(url : post가 연결되어야 할 api주소, data : 백엔드에서 정의한 request body).then(앞 코드가 정상작동하면 실행되는 다음 행위)
2220
axios.post('http://15.164.28.246:8000/api/v1/stores/login/',{
2321
email: email,
2422
password: password})

src/pages/StoreRegister/StoreRegister.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,4 +12,4 @@ function StoreRegister() {
1212
</div>);
1313
}
1414

15-
export default StoreRegister; //import를 하기 위해선 export(내보내기)를 해야 한다
15+
export default StoreRegister;

src/pages/WaitingList/WaitingList.tsx

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -65,18 +65,8 @@ function WaitingList() {
6565
const [temp, setTemp] = useState<res>();
6666

6767

68-
// { // 지정을 해줬더라도 덮어지기 때문에 이대로 진행해도 괜찮다!
69-
// information: '',
70-
// is_waiting : true,
71-
// waiting : [{
72-
// waiting_id : 0,
73-
// name: '민아',
74-
// people: 4,
75-
// phone_num: '010-0000-0000'
76-
// }]}
7768

7869
const getList = async() => {
79-
//const res = await rankingService.getMyRanking();
8070
axios.get<res>('http://15.164.28.246:8000/api/v1/stores/waitings/',
8171
{
8272
headers : {Authorization: localStorage.getItem('accessToken')}
@@ -93,24 +83,19 @@ function WaitingList() {
9383
getList()
9484
}, [])
9585

96-
// console.log('민아 temp 확인')
97-
console.log(temp);
98-
86+
9987
return (
10088
<Container style={{display: 'flex', overflow: 'hidden'}}>
10189
<div>
10290
<Logo/>
10391
<Calender/>
104-
{/* axios 받아왔던 information정보들을 StoreInformation컴포넌트 호출할 때 넣어줘야해, 그래야 컴포넌트 값이 넘어가 / 이때 useLocation 사용?*/}
10592
<StoreInformation information={temp?.information}/>
10693
</div>
10794
<div className="VerticalLine"></div>
10895
<div>
10996
<TableTitle/>
11097
<ListTableStyle/>
11198
<ListTable waiting={temp?.data} setTemp={setTemp} />
112-
{/* temp={temp} */}
113-
{/* <ListTable waiting={test} /> */}
11499
<SubButton/>
115100
</div>
116101
</Container>

0 commit comments

Comments
 (0)