Skip to content

Commit

Permalink
fix: adds authoriztion to fetch
Browse files Browse the repository at this point in the history
  • Loading branch information
SilveerDusk committed Jun 4, 2024
1 parent 562a5dd commit 755c071
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/lib/fetches.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -253,5 +253,10 @@ export const loginUser = async (credentials: {
};

export const fetchUserByUsername = async (username: string) => {
return fetch(`${vite_backend_url}/users/username/${username}`);
console.log(localStorage.getItem("token"));
return fetch(`${vite_backend_url}/users/username/${username}`, {
headers: {
Authorization: `Bearer ${localStorage.getItem("token")}`,
},
});
};

0 comments on commit 755c071

Please sign in to comment.