feat: add ability to define expiration of one time link

This commit is contained in:
Elias Schneider
2024-10-31 17:22:58 +01:00
parent 590cb02f6c
commit 2ccabf835c
4 changed files with 79 additions and 29 deletions

View File

@@ -42,10 +42,10 @@ export default class UserService extends APIService {
await this.api.delete(`/users/${id}`);
}
async createOneTimeAccessToken(userId: string) {
async createOneTimeAccessToken(userId: string, expiresAt: Date) {
const res = await this.api.post(`/users/${userId}/one-time-access-token`, {
userId,
expiresAt: new Date(Date.now() + 1000 * 60 * 5).toISOString()
expiresAt
});
return res.data.token;
}