20 lines
371 B
TypeScript
Raw Normal View History

2019-11-18 02:04:13 +00:00
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)
}
}