Skip to content

Commit

Permalink
fix: request body error
Browse files Browse the repository at this point in the history
  • Loading branch information
jevil25 committed Sep 26, 2023
1 parent eb80fd6 commit 6af3757
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
8 changes: 4 additions & 4 deletions src/Components/Auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -95,17 +95,17 @@ export const Login = (props: { forgot?: boolean }) => {
// replaces button with spinner
setLoading(true);

const { res, data } = await request(routes.login, {
pathParams: { ...valid },
const { res, data, error } = await request(routes.login, {
body: { ...valid },
});
console.log(res, data, error);
if (res && res.status === 429) {
setCaptcha(true);
// captcha displayed set back to login button
setLoading(false);
} else if (res && res.status === 200 && data) {
localStorage.setItem(LocalStorageKeys.accessToken, data.access);
localStorage.setItem(LocalStorageKeys.refreshToken, data.refresh);

if (
window.location.pathname === "/" ||
window.location.pathname === "/login"
Expand Down Expand Up @@ -149,7 +149,7 @@ export const Login = (props: { forgot?: boolean }) => {
if (valid) {
setLoading(true);
const { res, error } = await request(routes.forgotPassword, {
pathParams: { ...valid },
body: { ...valid },
});
setLoading(false);
if (res && res.statusText === "OK") {
Expand Down
4 changes: 2 additions & 2 deletions src/Components/Auth/ResetPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ export const ResetPassword = (props: any) => {
if (valid) {
valid.token = props.token;
const { res, error } = await request(routes.resetPassword, {
pathParams: { ...valid },
body: { ...valid },
});
if (res && res.statusText === "OK") {
localStorage.removeItem(LocalStorageKeys.accessToken);
Expand All @@ -87,7 +87,7 @@ export const ResetPassword = (props: any) => {
useEffect(() => {
const checkResetToken = async () => {
const { res } = await request(routes.checkResetToken, {
pathParams: { token: props.token },
body: { token: props.token },
});
if (!res || res.statusText !== "OK") {
navigate("/invalid-reset");
Expand Down

0 comments on commit 6af3757

Please sign in to comment.