pis #2
@ -130,8 +130,23 @@ async function getApi(path,auth = false) {
|
|||||||
let apiVer = 'v1'
|
let apiVer = 'v1'
|
||||||
let url = `${window.location.origin}/api/${apiVer}/${path}`
|
let url = `${window.location.origin}/api/${apiVer}/${path}`
|
||||||
log(`getApi: Fetching from endpoint: ${url}, Auth=${auth}`)
|
log(`getApi: Fetching from endpoint: ${url}, Auth=${auth}`)
|
||||||
|
if (auth) {
|
||||||
|
let key = localStorage.getItem('uuid')
|
||||||
|
var options = {
|
||||||
|
method: "GET",
|
||||||
|
redirect: "follow",
|
||||||
|
headers: {
|
||||||
|
"uuid": key
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
var options = {
|
||||||
|
method: "GET",
|
||||||
|
redirect: "follow"
|
||||||
|
}
|
||||||
|
}
|
||||||
try {
|
try {
|
||||||
var resp = await fetch(url)
|
var resp = await fetch(url, options)
|
||||||
var json = await resp.json()
|
var json = await resp.json()
|
||||||
log(`resp.status: ${resp.status}`)
|
log(`resp.status: ${resp.status}`)
|
||||||
log(`resp.json: ${json}`)
|
log(`resp.json: ${json}`)
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
hideLoading()
|
hideLoading()
|
||||||
|
versionDisplay()
|
||||||
|
|
||||||
async function findByOrigDest() {
|
async function findByOrigDest() {
|
||||||
showLoading()
|
showLoading()
|
||||||
|
2
pis.html
2
pis.html
@ -63,7 +63,7 @@
|
|||||||
<button id="reset" class="lookup-button" onclick="reset()">Reset</button>
|
<button id="reset" class="lookup-button" onclick="reset()">Reset</button>
|
||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<footer>
|
<footer>
|
||||||
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - <span id="ver_str">dev</span></p>
|
<p>Created by <a href="https://fredboniface.co.uk" target="_blank" rel="noreferrer noopener">Fred Boniface</a> - <span id="ver_str">d</span></p>
|
||||||
</footer>
|
</footer>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Reference in New Issue
Block a user