ijunseong

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

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