blob: cc790a7276ac4bb6061f223a7bef7405df1c4c4e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
|
import { API_ROOT } from "./global.js"
const {team: TEAM, username: USERNAME} = getUserInfo()
async function increment() {
const response = await fetch(`${API_ROOT}/increment/${TEAM}/${USERNAME}`, {"method": "POST"})
const {points} = await response.json()
return points
}
function getUserInfo() {
const urlParams = new URLSearchParams(window.location.search);
return {"team": urlParams.get("team"), "username": urlParams.get("username")}
}
async function getUserPoints() {
const response = await fetch(`${API_ROOT}/points/${TEAM}/${USERNAME}`)
const {points} = await response.json()
return points
}
document.querySelector("#increment").addEventListener("click", increment)
document.querySelector(".username")
|