Skip to content

Commit

Permalink
Changed Home Page
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiganesh committed Oct 7, 2023
1 parent c0e5d01 commit 0cd6136
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 51 deletions.
51 changes: 0 additions & 51 deletions pages/chess.js

This file was deleted.

49 changes: 49 additions & 0 deletions pages/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
async function get_stats(){


const inputfieldname = document.getElementById("username")
const username = inputfieldname.value

console.log(username)
const player_details_url = `https://api.chess.com/pub/player/${username}`
const player_details_response = await fetch(player_details_url)

const player_details = await player_details_response.json();

document.querySelector("#avatar_image").src = player_details.avatar
document.querySelector("#avatar_name").innerHTML = player_details.name





let dictionary = {
photo : player_details.avatar,
name : player_details.name,
username: player_details.username,
location: player_details.location,
league : player_details.league
}




return dictionary

}

function Chess(){

return (
<div>
<label>Name</label>
<input type="text" name="name" id="username" onChange={get_stats}/>

<img src="" id="avatar_image"></img>
<p1 id="avatar_name"></p1>

</div>
)
}

export default Chess

0 comments on commit 0cd6136

Please sign in to comment.