forked from joshua1988/learn-typescript
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7d559da
commit c7febf2
Showing
2 changed files
with
44 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// api url | ||
var url = 'https://jsonplaceholder.typicode.com/users/1'; | ||
|
||
// dom | ||
var username = document.querySelector('#username'); | ||
var email = document.querySelector('#email'); | ||
var address = document.querySelector('#address'); | ||
|
||
// user data | ||
var user = {}; | ||
|
||
function startApp() { | ||
axios | ||
.get(url) | ||
.then(function (response) { | ||
console.log(response); | ||
user = response.data; | ||
// TODO: 이름, 이메일, 주소 표시하기 | ||
}) | ||
.catch(function (error) { | ||
console.log(error); | ||
}); | ||
} | ||
|
||
startApp(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="UTF-8" /> | ||
<meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
<title>Why Typescript?</title> | ||
</head> | ||
<body> | ||
<h1>사용자 정보</h1> | ||
<div> | ||
<p>이름: <span id="username"></span></p> | ||
<p>이메일: <span id="email"></span></p> | ||
<p>주소: <span id="address"></span></p> | ||
</div> | ||
|
||
<script src="https://unpkg.com/axios/dist/axios.min.js"></script> | ||
<script src="./app.js"></script> | ||
</body> | ||
</html> |