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
```html
<div class="peppershrike" data-id="1"></div>

<script src="peppershrike.js" data-host="http://localhost:80/api/v1"></script>
<script src="peppershrike.js" data-host="http://localhost"></script>
<script>
Peppershrike.find();
</script>


+ 3
- 1
peppershrike.js Visa fil

@@ -1,6 +1,6 @@
const current = document.currentScript;

let defaultHost = '/api/v1';
let defaultHost = '';

if (current.dataset.host) {
defaultHost = current.dataset.host;
@@ -23,6 +23,8 @@ class Peppershrike {
this.host = host;
}

this.host += '/api/v1'; // v1 of API, so we don't have to include this in the host every time

this.doneMessage = doneMessage;
this.errorMessage = errorMessage;



Laddar…
Avbryt
Spara