Skip to content

Commit

Permalink
Update ToS Endpoint (#1207)
Browse files Browse the repository at this point in the history
  • Loading branch information
AbdBarho authored Feb 5, 2023
1 parent edfc40d commit 9467b21
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions website/src/lib/oasst_api_client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -303,9 +303,8 @@ export class OasstApiClient {
}

async set_tos_acceptance(user: BackendUserCore) {
// TODO: it is wasteful having to get the backend user first and then set the tos status
// is there a better way of doing this?
const backendUser = await this.get<BackendUser>(`/api/v1/frontend_users/${user.auth_method}/${user.id}`);
// NOTE: we do a post here to force create the user if it does not exist
const backendUser = await this.post<BackendUser>(`/api/v1/frontend_users/`, user);
await this.put<void>(`/api/v1/users/${backendUser.user_id}?tos_acceptance=true`);
}
}

0 comments on commit 9467b21

Please sign in to comment.