File tree Expand file tree Collapse file tree 5 files changed +42
-5
lines changed Expand file tree Collapse file tree 5 files changed +42
-5
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,7 @@ import Footer from "./modules/Footer/Footer.tsx";
99import SignUpForm from "./modules/Header/SignUpForm.tsx" ;
1010import Board from "./modules/Community/index.tsx" ;
1111import BoardView from "./modules/Community/BoardView.tsx" ;
12+ import BingoQR from "./modules/Bingo/BingoQR.tsx" ;
1213import { Container , CssBaseline } from "@mui/material" ;
1314import { createTheme , ThemeProvider } from "@mui/material/styles" ;
1415
@@ -21,13 +22,14 @@ function App() {
2122 < CssBaseline />
2223 < Container className = "App" >
2324 < Header />
24- < Routes >
25+ < Routes >
2526 < Route path = "/" Component = { Home } />
2627 < Route path = "/builder" element = { < IntroduceBuilder /> } />
2728 < Route path = "/runner" element = { < Test /> } />
2829 < Route path = "/community/*" element = { < Board /> } />
2930 < Route path = "/bingo" element = { < Bingo /> } />
3031 < Route path = "/signup" element = { < SignUpForm /> } />
32+ < Route path = "/bingo_qr/:id" element = { < BingoQR /> } />
3133 { /* <Route path="/posts" component={Posts} />
3234 <Route path="/posts/:id" component={Post} />
3335 <Route path="/posts/new" component={NewPost} />
Original file line number Diff line number Diff line change @@ -117,3 +117,14 @@ export const getUserName = async (userId: string) => {
117117 const userName = data [ "username" ] ;
118118 return userName ;
119119} ;
120+
121+ export const updateBingoFromQR = async ( userId : string , targetId : string ) => {
122+ const response = await fetch (
123+ `${ API_URL } /api/bingo/boards/update/${ userId } /${ targetId } ` ,
124+ {
125+ method : "PATCH" ,
126+ }
127+ ) ;
128+ const data = await response . json ( ) ;
129+ return data ;
130+ } ;
Original file line number Diff line number Diff line change @@ -106,7 +106,6 @@ const BingoContainer = () => {
106106 userLatestInteraction . send_user_id
107107 ) ;
108108 const wordList = userLatestInteraction . word_id_list ;
109- localStorage . setItem ( "recentWords" , wordList ) ;
110109 localStorage . setItem ( "recentSendUser" , sendUserName ) ;
111110 setRecentWords ( wordList ) ;
112111 setRecentSendUser ( sendUserName ) ;
Original file line number Diff line number Diff line change @@ -174,7 +174,7 @@ const BingoPresenter = (props: BingoPresenterProps) => {
174174 { /* {props.userSelectedWords.map((word) => (
175175 <LongTextBox key={word} text={word} />
176176 ))} */ }
177- < RecentSendUserWrapper >
177+ { /* <RecentSendUserWrapper>
178178 {props.recentSendUser === "" ? (
179179 ""
180180 ) : (
@@ -185,14 +185,14 @@ const BingoPresenter = (props: BingoPresenterProps) => {
185185 <span> 님과 이야기를 나누었어요!</span>
186186 </>
187187 )}
188- </ RecentSendUserWrapper >
188+ </RecentSendUserWrapper> */ }
189189 < BingoContainer >
190190 { props . bingoWords . map ( ( { value, status } ) => (
191191 < SqaureTextBox
192192 key = { value }
193193 value = { value }
194194 status = { status }
195- recent_list = { props . recentWords . split ( "|" ) }
195+ recent_list = { [ "" ] }
196196 />
197197 ) ) }
198198 </ BingoContainer >
Original file line number Diff line number Diff line change 1+ import { useEffect } from "react" ;
2+ import { useParams } from "react-router-dom" ;
3+ import { getUser , updateBingoBoard } from "../../api/bingo_api" ;
4+
5+ const BingoQR = ( ) => {
6+ const { id } = useParams ( ) ;
7+
8+ useEffect ( ( ) => {
9+ // API 호출
10+ const fetchData = async ( ) => {
11+ const myId = localStorage . getItem ( "myID" ) ;
12+ if ( myId === null ) window . location . href = "" ;
13+
14+ const user = await getUser ( myId ) ;
15+ const result = await updateBingoBoard ( id , user . user_id ) ;
16+ if ( result === true ) window . location . href = "/bingo" ;
17+ } ;
18+
19+ fetchData ( ) ;
20+ } , [ ] ) ; // 빈 배열: 컴포넌트 마운트 시 한 번 실행
21+
22+ return < div > QR 체크중</ div > ;
23+ } ;
24+
25+ export default BingoQR ;
You can’t perform that action at this time.
0 commit comments