Bläddra i källkod

Remove requirement of adding /api/v1 in host.

master
Syfaro 1 år sedan
förälder
incheckning
20594a4267
2 ändrade filer med 4 tillägg och 2 borttagningar
  1. 1
    1
      README.md
  2. 3
    1
      peppershrike.js

+ 1
- 1
README.md Visa fil

@@ -9,7 +9,7 @@ allows for asking users a simple question rather than having them go to a separa
9 9
 ```html
10 10
 <div class="peppershrike" data-id="1"></div>
11 11
 
12
-<script src="peppershrike.js" data-host="http://localhost:80/api/v1"></script>
12
+<script src="peppershrike.js" data-host="http://localhost"></script>
13 13
 <script>
14 14
     Peppershrike.find();
15 15
 </script>

+ 3
- 1
peppershrike.js Visa fil

@@ -1,6 +1,6 @@
1 1
 const current = document.currentScript;
2 2
 
3
-let defaultHost = '/api/v1';
3
+let defaultHost = '';
4 4
 
5 5
 if (current.dataset.host) {
6 6
     defaultHost = current.dataset.host;
@@ -23,6 +23,8 @@ class Peppershrike {
23 23
             this.host = host;
24 24
         }
25 25
 
26
+        this.host += '/api/v1'; // v1 of API, so we don't have to include this in the host every time
27
+
26 28
         this.doneMessage = doneMessage;
27 29
         this.errorMessage = errorMessage;
28 30
 

Laddar…
Avbryt
Spara