From 4d14f2bf37056db72bb5cb06f90e47cfacfc8152 Mon Sep 17 00:00:00 2001 From: AaronNazareth <4nm20cs005@nmamit.in> Date: Thu, 28 Sep 2023 19:37:07 +0530 Subject: [PATCH] change:Tres to Tbody --- src/Components/Auth/Login.tsx | 2 +- src/Redux/api.tsx | 17 +++++++++++++---- 2 files changed, 14 insertions(+), 5 deletions(-) diff --git a/src/Components/Auth/Login.tsx b/src/Components/Auth/Login.tsx index 98acecd06e9..dd6a42d3983 100644 --- a/src/Components/Auth/Login.tsx +++ b/src/Components/Auth/Login.tsx @@ -95,7 +95,7 @@ export const Login = (props: { forgot?: boolean }) => { // replaces button with spinner setLoading(true); - const { res, data, error } = await request(routes.login, { + const { res, data } = await request(routes.login, { body: { ...valid }, }); if (res && res.status === 429) { diff --git a/src/Redux/api.tsx b/src/Redux/api.tsx index d874e9faeb7..82bf438140e 100644 --- a/src/Redux/api.tsx +++ b/src/Redux/api.tsx @@ -17,6 +17,11 @@ interface JwtTokenObtainPair { refresh: string; } +interface LoginInput { + username: string; + password: string; +} + const routes = { config: { path: import.meta.env.REACT_APP_CONFIG ?? "/config.json", @@ -30,7 +35,8 @@ const routes = { path: "/api/v1/auth/login/", method: "POST", noAuth: true, - TRes: Res(), + TRes: Type(), + TBody: Type(), }, token_refresh: { @@ -48,19 +54,22 @@ const routes = { checkResetToken: { path: "/api/v1/password_reset/check/", method: "POST", - TRes: Res(), + TRes: Type(), + TBody: Type<{ token: string }>(), }, resetPassword: { path: "/api/v1/password_reset/confirm/", method: "POST", - TRes: Res(), + TRes: Type(), + TBody: Type<{ password: string; confirm: string }>(), }, forgotPassword: { path: "/api/v1/password_reset/", method: "POST", - TRes: Res(), + TRes: Type(), + TBody: Type<{ username: string }>(), }, updatePassword: {