Skip to content

Commit

Permalink
#113: update auth header
Browse files Browse the repository at this point in the history
  • Loading branch information
eggwhat committed Jan 14, 2024
1 parent bdad087 commit ee899e6
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
6 changes: 3 additions & 3 deletions SwiftParcel.Web/frontend/src/components/modals/loginModal.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {
import {
Alert,
Button,
Label,
Expand All @@ -8,7 +8,7 @@ import {
} from "flowbite-react";
import React from "react";
import { Link } from "react-router-dom";
import { login } from "../../utils/api";
import { slogin } from "../../utils/api";
import { saveUserInfo } from "../../utils/storage";
import { HiInformationCircle } from "react-icons/hi";

Expand Down Expand Up @@ -36,7 +36,7 @@ export function LoginModal(props: LoginModalProps) {
setError("");
setIsLoading(true);

login(email, password)
slogin(email, password)
.then(async (res) => {
console.log(res)

Expand Down
4 changes: 2 additions & 2 deletions SwiftParcel.Web/frontend/src/utils/api.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ const getAuthHeader = () => {
return null;
}
console.log({Authorization: `Bearer ${userInfo.accessToken}`})
return { Authorization: `${userInfo.accessToken}` };
return { Authorization: `Bearer ${userInfo.accessToken}` };
};

const defaultPageLimit = 10;

export const login = async (email: string, password: string) => {
export const slogin = async (email: string, password: string) => {
try {
const response = await api.post('/identity/sign-in', { email, password });
const { accessToken, refreshToken, role, expires } = response.data;
Expand Down

0 comments on commit ee899e6

Please sign in to comment.