ijunseong

Update: 로그인 화면 렌더링 수정

This diff could not be displayed because it is too large.
1 +import React from "react";
1 import './App.css'; 2 import './App.css';
2 import Login from "./Login"; 3 import Login from "./Login";
3 import Body from "./Body"; 4 import Body from "./Body";
4 5
5 -function App() { 6 +const qs= require('querystring');
6 - // let accessToken = null; 7 +const url = require('url')
7 - let accessToken = 1;
8 8
9 - return ( 9 +class App extends React.Component {
10 - <div className="app"> 10 + constructor(props){
11 - {!accessToken && <Login />} 11 + super(props);
12 - {accessToken && <Body />} 12 + this.state = {
13 - </div> 13 + isAuthenticated: false,
14 - ); 14 + }
15 + }
16 +
17 + componentDidMount(props){
18 + var urlQuery = url.parse(window.location.href).query;
19 + var param = qs.parse(urlQuery);
20 + this.setState({ isAuthenticated : param.authenticated}, () => {
21 + this.render();
22 + })
23 + }
24 +
25 + render(){
26 + return (
27 + <div className="app">
28 + {!this.state.isAuthenticated && <Login />}
29 + {this.state.isAuthenticated && <Body />}
30 + </div>
31 + );
32 + }
15 } 33 }
16 34
17 export default App; 35 export default App;
......
1 +const test = [
2 + {"name": "name1", "view": 999, "game": "game1" ,"url": "https://www.twitch.tv", "thumbnail": "https://upload.wikimedia.org/wikipedia/commons/2/26/Twitch_logo.svg", "isPlay": true},
3 + {"name": "name2", "view": 123124124, "game": "game2" , "url": "https://www.twitch.tv"},
4 + {"name": "name1", "view": 999, "game": "game1" ,"url": "https://www.twitch.tv", "thumbnail": "https://upload.wikimedia.org/wikipedia/commons/2/26/Twitch_logo.svg"},
5 + {"name": "name2", "view": 123124124, "game": "game2" , "url": "https://www.twitch.tv"},
6 + {"name": "name1", "view": 999, "game": "game1" ,"url": "https://www.twitch.tv", "thumbnail": "https://upload.wikimedia.org/wikipedia/commons/2/26/Twitch_logo.svg"},
7 + {"name": "name2", "view": 123124124, "game": "game2" , "url": "https://www.twitch.tv"},
8 + {"name": "name1", "view": 999, "game": "game1" ,"url": "https://www.twitch.tv", "thumbnail": "https://upload.wikimedia.org/wikipedia/commons/2/26/Twitch_logo.svg"},
9 + {"name": "name2", "view": 123124124, "game": "game2" , "url": "https://www.twitch.tv"},
10 + {"name": "name1", "view": 999, "game": "game1" ,"url": "https://www.twitch.tv", "thumbnail": "https://upload.wikimedia.org/wikipedia/commons/2/26/Twitch_logo.svg"},
11 + {"name": "name2", "view": 123124124, "game": "game2" , "url": "https://www.twitch.tv"},
12 +]
13 +
14 +console.log(test[1])
15 +test[1].isPlay = false
16 +const whatPlay = (elem) => elem.isPlay === true;
17 +console.log(test.findIndex(whatPlay))
...\ No newline at end of file ...\ No newline at end of file
This diff could not be displayed because it is too large.
1 +{
2 + "name": "khuwitch",
3 + "lockfileVersion": 2,
4 + "requires": true,
5 + "packages": {}
6 +}
This diff is collapsed. Click to expand it.
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
10 "author": "Daeyeonkim97", 10 "author": "Daeyeonkim97",
11 "license": "ISC", 11 "license": "ISC",
12 "dependencies": { 12 "dependencies": {
13 - "cors": "^2.8.5",
14 "axios": "^0.21.0", 13 "axios": "^0.21.0",
14 + "cors": "^2.8.5",
15 "dotenv": "^8.2.0", 15 "dotenv": "^8.2.0",
16 "ejs": "^3.1.5", 16 "ejs": "^3.1.5",
17 "express": "^4.17.1", 17 "express": "^4.17.1",
......