Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

map is working need to add some test data #31

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified frontend/bun.lockb
Binary file not shown.
21 changes: 19 additions & 2 deletions frontend/network/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,28 @@ export const api = axios.create({

api.interceptors.request.use(async (config) => {
const auth = getAuth();
const token = await auth.currentUser?.getIdToken();
console.log("attaching token", token)
const user = auth.currentUser;
let token = null;

if (user) {
try {
token = await user.getIdToken();
console.log("Firebase token obtained successfully");
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider removing or reducing the verbosity of console logs in production code to prevent potential exposure of sensitive information and to keep the console output clean.

console.log("token", token)
} catch (error) {
console.error("Error getting Firebase token:", error);
}
} else {
console.log("No current user found");
}

if (token) {
config.headers.Authorization = `Bearer ${token}`;
console.log("Authorization header set");
} else {
console.log("No token available, request will be unauthorized");
}

return config;
}, (error) => {
return Promise.reject(error);
Expand Down
Loading