Skip to content

Commit

Permalink
fix: pass auth token to data loader (#3499)
Browse files Browse the repository at this point in the history
Broken since refactoring to loading builder data client side.
  • Loading branch information
TrySound committed Jun 5, 2024
1 parent 2eaa43f commit 6874585
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion apps/builder/app/shared/builder-data.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,13 @@ export const loadBuilderData = async ({
projectId: string;
signal: AbortSignal;
}) => {
const response = await fetch(`/rest/data/${projectId}`, { signal });
const currentUrl = new URL(location.href);
const authToken = currentUrl.searchParams.get("authToken");
const url = new URL(`/rest/data/${projectId}`, currentUrl.origin);
if (authToken) {
url.searchParams.set("authToken", authToken);
}
const response = await fetch(url, { signal });
if (response.ok) {
const data = (await response.json()) as {
assets: Asset[];
Expand Down

0 comments on commit 6874585

Please sign in to comment.