Refactor authentication and implement password reset. #3

Merged
Chaoscaot merged 5 commits from develop/authv2 into master 2025-02-25 22:39:40 +01:00
16 changed files with 363 additions and 98 deletions
Showing only changes of commit 2c63a33bda - Show all commits

View File

@ -155,7 +155,7 @@ export class AuthV2Repo {
} }
async request(url: string, params: RequestInit = {}) { async request(url: string, params: RequestInit = {}) {
if (this.accessToken !== undefined && this.accessTokenExpires !== undefined && this.accessTokenExpires.isBefore(dayjs())) { if (this.accessToken !== undefined && this.accessTokenExpires !== undefined && this.accessTokenExpires.isBefore(dayjs().add(10, "seconds"))) {
await this.refresh(); await this.refresh();
} }

View File

@ -36,7 +36,7 @@ export class StatsRepo {
} }
public async getUserStats(id: string): Promise<UserStats> { public async getUserStats(id: string): Promise<UserStats> {
return await fetchWithToken(this.token, `/stats/user/${id}`).then(value => value.json()).then(UserStatsSchema.parse); return await fetchWithToken(this.token, `/stats/user`).then(value => value.json()).then(UserStatsSchema.parse);
} }
} }