From 9467b21d538fb7a5dc191e0246d348f08ce153e5 Mon Sep 17 00:00:00 2001 From: AbdBarho Date: Sun, 5 Feb 2023 21:51:13 +0100 Subject: [PATCH] Update ToS Endpoint (#1207) --- website/src/lib/oasst_api_client.ts | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/website/src/lib/oasst_api_client.ts b/website/src/lib/oasst_api_client.ts index 30fb9885..3f730b72 100644 --- a/website/src/lib/oasst_api_client.ts +++ b/website/src/lib/oasst_api_client.ts @@ -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(`/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(`/api/v1/frontend_users/`, user); await this.put(`/api/v1/users/${backendUser.user_id}?tos_acceptance=true`); } }