Skip to content

Commit

Permalink
⚙️ Add url param to sandbox (#15)
Browse files Browse the repository at this point in the history
  • Loading branch information
agoose77 authored Mar 22, 2024
1 parent 222af3c commit 21987a9
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions theme/app/routes/sandbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,15 @@ export const loader: LoaderFunction = async ({ request }) => {
const url = new URL(request.url);
const myst = url.searchParams.get('myst');
const tab = url.searchParams.get('tab');

const data = myst ? fromBinary(atob(myst)) : undefined;
const srcURL = url.searchParams.get("url");

let data;
if (srcURL) {
const response = await fetch(srcURL);
data = await response.text();
} else {
data = myst ? fromBinary(atob(myst)) : undefined;
}
return json({ data, tab });
};

Expand Down

0 comments on commit 21987a9

Please sign in to comment.