diff --git a/src/components/dashboard/CompanyApplicationsPage.tsx b/src/components/dashboard/CompanyApplicationsPage.tsx
index a0a1ff9..ec78e18 100644
--- a/src/components/dashboard/CompanyApplicationsPage.tsx
+++ b/src/components/dashboard/CompanyApplicationsPage.tsx
@@ -38,10 +38,18 @@ interface ContactInfo {
}
async function apiFetch(path: string, opts?: RequestInit) {
+ const token =
+ typeof window !== "undefined"
+ ? window.sessionStorage.getItem("nxtgauge_access_token") || ""
+ : "";
return fetch(`${API}${path}`, {
...opts,
credentials: "include",
- headers: { "Content-Type": "application/json", ...(opts?.headers ?? {}) },
+ headers: {
+ "Content-Type": "application/json",
+ ...(token ? { Authorization: `Bearer ${token}` } : {}),
+ ...(opts?.headers ?? {}),
+ },
});
}
diff --git a/src/components/dashboard/CompanyJobsPage.tsx b/src/components/dashboard/CompanyJobsPage.tsx
index 258d64b..0692aaa 100644
--- a/src/components/dashboard/CompanyJobsPage.tsx
+++ b/src/components/dashboard/CompanyJobsPage.tsx
@@ -58,10 +58,18 @@ const EMPTY_FORM: JobFormState = {
};
async function apiFetch(path: string, opts?: RequestInit) {
+ const token =
+ typeof window !== "undefined"
+ ? window.sessionStorage.getItem("nxtgauge_access_token") || ""
+ : "";
return fetch(`${API}${path}`, {
...opts,
credentials: "include",
- headers: { "Content-Type": "application/json", ...(opts?.headers ?? {}) },
+ headers: {
+ "Content-Type": "application/json",
+ ...(token ? { Authorization: `Bearer ${token}` } : {}),
+ ...(opts?.headers ?? {}),
+ },
});
}
diff --git a/src/components/dashboard/CompanyShortlistedCandidatesPage.tsx b/src/components/dashboard/CompanyShortlistedCandidatesPage.tsx
index c7a494a..b969f93 100644
--- a/src/components/dashboard/CompanyShortlistedCandidatesPage.tsx
+++ b/src/components/dashboard/CompanyShortlistedCandidatesPage.tsx
@@ -14,10 +14,18 @@ type ApplicationItem = {
};
async function apiFetch(path: string, opts?: RequestInit) {
+ const token =
+ typeof window !== "undefined"
+ ? window.sessionStorage.getItem("nxtgauge_access_token") || ""
+ : "";
return fetch(`${API}${path}`, {
...opts,
- credentials: 'include',
- headers: { 'Content-Type': 'application/json', ...(opts?.headers ?? {}) },
+ credentials: "include",
+ headers: {
+ "Content-Type": "application/json",
+ ...(token ? { Authorization: `Bearer ${token}` } : {}),
+ ...(opts?.headers ?? {}),
+ },
});
}
diff --git a/src/components/dashboard/CreditsPage.tsx b/src/components/dashboard/CreditsPage.tsx
index 78de671..96af5dc 100644
--- a/src/components/dashboard/CreditsPage.tsx
+++ b/src/components/dashboard/CreditsPage.tsx
@@ -34,10 +34,18 @@ type CheckoutState = {
};
async function apiFetch(path: string, opts?: RequestInit) {
+ const token =
+ typeof window !== "undefined"
+ ? window.sessionStorage.getItem("nxtgauge_access_token") || ""
+ : "";
return fetch(`${API}${path}`, {
...opts,
credentials: "include",
- headers: { "Content-Type": "application/json", ...(opts?.headers ?? {}) },
+ headers: {
+ "Content-Type": "application/json",
+ ...(token ? { Authorization: `Bearer ${token}` } : {}),
+ ...(opts?.headers ?? {}),
+ },
});
}
@@ -770,7 +778,7 @@ export default function CreditsPage(props: Props) {
-