Ron Au commited on
Commit
df36afa
1 Parent(s): 360c090

fix(Spaces): Resolve URL in cross-origin iframe

Browse files
Files changed (1) hide show
  1. static/js/index.js +2 -1
static/js/index.js CHANGED
@@ -36,7 +36,8 @@ const generate = async () => {
36
 
37
  await new Promise((resolve) => setTimeout(resolve, 5_000));
38
 
39
- const cardResponse = await fetch('/new_card');
 
40
  const card = await cardResponse.json();
41
 
42
  pokeName = card.details.name;
 
36
 
37
  await new Promise((resolve) => setTimeout(resolve, 5_000));
38
 
39
+ const resolvedCardUrl = new URL('new_card', document.location.origin + document.location.pathname).href;
40
+ const cardResponse = await fetch(resolvedCardUrl);
41
  const card = await cardResponse.json();
42
 
43
  pokeName = card.details.name;