Skip to content

Commit 987990a

Browse files
Merge pull request #331 from isucon/frontend/267_jia-login-style
[frontend] ログイン画面をましにした
2 parents 53f1465 + c3a8be1 commit 987990a

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

webapp/jiaapi_mock/index.html

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
<!DOCTYPE html>
22
<html>
33

4-
<body>
5-
<div style="display: flex;flex-direction: column;">
4+
<body style="padding: 3.5rem;display: flex;justify-content: center;">
5+
<div
6+
style="display: flex;flex-direction: column;padding: 4rem;max-width: 56rem;gap: 0.5rem;border: 1px solid;border-color: dimgray;border-radius: 0.5rem;align-items: center;">
7+
<h2 style="align-self: flex-start;">Sign in with JIA</h2>
68
<label>
79
ユーザー名
810
<input id="user">
@@ -11,7 +13,8 @@
1113
パスワード
1214
<input id="password" type="password">
1315
</label>
14-
<button id="login">login</button>
16+
<button id="login"
17+
style="margin-top: 1.5rem;background-color: transparent;border-color: dimgray;cursor: pointer;outline: none;padding: 0.1rem;width: 5rem;appearance: none;border-radius: 8px;">login</button>
1518
</div>
1619
</body>
1720
<script>
@@ -24,10 +27,14 @@
2427
headers: { 'Content-Type': 'application/json' },
2528
body: JSON.stringify({ user: userEl.value, password: passwordEl.value })
2629
}).then(v => {
30+
if (!v.ok) {
31+
alert('ユーザー名かパスワードが間違っています')
32+
throw ''
33+
}
2734
console.log(v)
2835
v.text().then(jwt => {
2936
console.log(jwt)
30-
location.href = `http://localhost:3000?jwt=${jwt}`
37+
location.href = `${document.referrer}?jwt=${jwt}`
3138
})
3239
})
3340
})

0 commit comments

Comments
 (0)