This commit is contained in:
Fred Boniface 2023-05-08 21:31:47 +01:00
parent a2afa9f500
commit 9973da52a6
8 changed files with 24 additions and 15 deletions

View File

@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
/* /*
Auth process: User Requests Key => Server emails key to user => Auth process: User Requests Key => Server emails key to user =>
user opens link to auth.html => user opens link to auth.html =>

View File

@ -1,14 +1,15 @@
hideLoading() hideLoading()
// eslint-disable-next-line no-unused-vars
async function fetchEntry(){ // This can be condensed async function fetchEntry(){ // This can be condensed
showLoading() showLoading()
var name = document.getElementById('name') let name = document.getElementById('name')
var crs = document.getElementById('3alpha') let crs = document.getElementById('3alpha')
var nlc = document.getElementById('nlc') let nlc = document.getElementById('nlc')
var tiploc = document.getElementById('tiploc') let tiploc = document.getElementById('tiploc')
var stanox = document.getElementById('stanox') let stanox = document.getElementById('stanox')
var values = { let values = {
name: name.value, name: name.value,
crs: crs.value, crs: crs.value,
nlc: nlc.value, nlc: nlc.value,
@ -71,19 +72,19 @@ async function displayData(data){
vibe('ok') vibe('ok')
try { try {
document.getElementById('name').value = data['0']['NLCDESC'] document.getElementById('name').value = data['0']['NLCDESC']
} catch (err) {} } catch (err) {log(err)}
try { try {
document.getElementById('3alpha').value = data['0']['3ALPHA'] document.getElementById('3alpha').value = data['0']['3ALPHA']
} catch (err) {} } catch (err) {log(err)}
try { try {
document.getElementById('nlc').value = data['0']['NLC'] document.getElementById('nlc').value = data['0']['NLC']
} catch (err) {} } catch (err) {log(err)}
try { try {
document.getElementById('tiploc').value = data['0']['TIPLOC'] document.getElementById('tiploc').value = data['0']['TIPLOC']
} catch (err) {} } catch (err) {log(err)}
try { try {
document.getElementById('stanox').value = data['0']['STANOX'] document.getElementById('stanox').value = data['0']['STANOX']
} catch (err) {} } catch (err) {log(err)}
} }
} }

View File

@ -11,6 +11,7 @@ async function pageInit() {
hideLoading() // From lib.main hideLoading() // From lib.main
} }
// eslint-disable-next-line no-unused-vars
async function gotoBoard(station){ async function gotoBoard(station){
vibe('ok') vibe('ok')
window.location.assign(`${window.location.origin}/board.html?stn=${station}`) window.location.assign(`${window.location.origin}/board.html?stn=${station}`)

View File

@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
init() init()
async function init() { async function init() {

View File

@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
/* All Page Init */ /* All Page Init */
const version = '2.0.2' const version = '2.0.2'
@ -130,9 +131,10 @@ 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}`)
let options
if (auth) { if (auth) {
let key = localStorage.getItem('uuid') let key = localStorage.getItem('uuid')
var options = { options = {
method: 'GET', method: 'GET',
redirect: 'follow', redirect: 'follow',
headers: { headers: {
@ -140,7 +142,7 @@ async function getApi(path,auth = false) {
} }
} }
} else { } else {
var options = { options = {
method: 'GET', method: 'GET',
redirect: 'follow' redirect: 'follow'
} }

View File

@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
hideLoading() hideLoading()
versionDisplay() versionDisplay()
showHideAuthNotice() showHideAuthNotice()

View File

@ -1,3 +1,4 @@
/* eslint-disable no-unused-vars */
// //
// Init: // Init:
// //

View File

@ -15,12 +15,13 @@ async function init() { // Gets query string and then fetch API response and pas
log('init: Staff Version not supported yet.') log('init: Staff Version not supported yet.')
log('init: Unable to proceed.') log('init: Unable to proceed.')
} else { } else {
let data
try { try {
var data = await publicLdb(stn) data = await publicLdb(stn)
setLoadingDesc(`${stn.toUpperCase()}\nParsing Data`) setLoadingDesc(`${stn.toUpperCase()}\nParsing Data`)
log('simple-board.init: Fetched LDB Data', 'INFO') log('simple-board.init: Fetched LDB Data', 'INFO')
} catch (err) { } catch (err) {
var data = 'err' data = 'err'
setLoadingDesc('Waiting\nConnection') setLoadingDesc('Waiting\nConnection')
log(`simple-board.init: Error fetching data: ${err}`, 'ERR') log(`simple-board.init: Error fetching data: ${err}`, 'ERR')
} }