Refactor scripts

This commit is contained in:
2019-11-18 11:04:13 +09:00
parent 7e25ee6faf
commit 1ddcd4d570
33 changed files with 670 additions and 749 deletions

19
scripts/User.ts Normal file
View File

@ -0,0 +1,19 @@
export default class User {
public id: string
private proExpires: string
public constructor(id: string) {
this.id = id
this.sync()
}
public IsPro(): boolean {
return new Date() > new Date(this.proExpires)
}
private async sync() {
const response = await fetch(`/api/user/${this.id}`)
const json = await response.json()
Object.assign(this, json)
}
}