Ron Au commited on
Commit
212b315
1 Parent(s): ed0a6c7

refactor(URLs): Remove uneeded path resolving

Browse files
Files changed (2) hide show
  1. static/index.html +2 -8
  2. static/js/index.js +2 -5
static/index.html CHANGED
@@ -10,17 +10,11 @@
10
  }
11
  </style>
12
  <link rel="shortcut icon" href="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" />
13
- <link rel="stylesheet" id="stylesheet-tag" />
14
  <link rel="preconnect" href="https://fonts.googleapis.com">
15
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
16
  <link href="https://fonts.googleapis.com/css2?family=Lato&display=swap" rel="stylesheet">
17
- <script type="module" id="script-tag"></script>
18
- <script>
19
- const basePath = document.location.origin + document.location.pathname;
20
- document.getElementById('stylesheet-tag').href = `${basePath}static/style.css`;
21
- document.getElementById('script-tag').src = `${basePath}static/js/index.js`;
22
- </script>
23
-
24
  </head>
25
  <body>
26
  <main>
10
  }
11
  </style>
12
  <link rel="shortcut icon" href="https://huggingface.co/front/assets/huggingface_logo-noborder.svg" />
13
+ <link rel="stylesheet" href="static/style.css" />
14
  <link rel="preconnect" href="https://fonts.googleapis.com">
15
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
16
  <link href="https://fonts.googleapis.com/css2?family=Lato&display=swap" rel="stylesheet">
17
+ <script type="module" src="static/js/index.js"></script>
 
 
 
 
 
 
18
  </head>
19
  <body>
20
  <main>
static/js/index.js CHANGED
@@ -39,11 +39,8 @@ const generate = async () => {
39
  await new Promise((resolve) => setTimeout(resolve, 2_000));
40
 
41
  pulls += 1;
42
- const resolvedCardUrl = new URL(
43
- `new_card?pull=${pulls}&saved=${saved}`,
44
- document.location.origin + document.location.pathname
45
- ).href;
46
- const cardResponse = await fetch(resolvedCardUrl);
47
  const card = await cardResponse.json();
48
 
49
  pokeName = card.details.name;
39
  await new Promise((resolve) => setTimeout(resolve, 2_000));
40
 
41
  pulls += 1;
42
+
43
+ const cardResponse = await fetch(`new_card?pull=${pulls}&saved=${saved}`);
 
 
 
44
  const card = await cardResponse.json();
45
 
46
  pokeName = card.details.name;