Compare commits

..

No commits in common. "0ce32f4a342f32d9f5c80977b0bfd06298239893" and "ef7d965523fd32c4c586c77065eef23fb3561b76" have entirely different histories.

3 changed files with 9 additions and 23 deletions

View File

@ -25,7 +25,6 @@ export async function fetchStaffLdb(station: string): Promise<ApiResponse<StaffL
return parseFormat(JSON.stringify(resJs));
}
// Parse dates within the JSON response
function parseFormat(jsonString: any): ApiResponse<StaffLdb> {
return JSON.parse(jsonString, (key, value) => {
if (typeof value === 'string') {

View File

@ -5,14 +5,12 @@
import { detailInit, defineDetail } from './train-detail';
import TrainDetail from './train-detail.svelte';
import { fetchStaffLdb } from './fetch';
import { error } from '@sveltejs/kit';
export let station: string;
export let title: string | undefined = 'Loading...';
let errorDetail = {
code: '',
message: '',
export let error = {
state: false,
name: 'none'
};
let detail = detailInit();
@ -31,8 +29,6 @@
title = data.data.locationName;
return data.data;
}
errorDetail.code = data.obStatus.toString() || "UNKNOWN";
errorDetail.message = data.obMsg || "An unknown error occoured";
throw new Error('Unable to Fetch Data');
}
</script>
@ -63,17 +59,11 @@
{/if}
{/if}
{:catch}
<h2>Error</h2>
<p>ERR-CODE: {errorDetail.code}</p>
<p>Message:<br>{errorDetail.message}</p>
Error Loading Data
{/await}
<style>
.transport-mode {
padding-top: 20px;
height: 17px;
}
.table-head-text {
color: white;
}
</style>
{#if error.state}
{#if error.name === 'unauthorized'}
<p>Error: {error.name.toLocaleUpperCase()}</p>
{/if}
{/if}

View File

@ -1,4 +1,3 @@
// Contains the details required to lookup train details
export interface Detail {
show: boolean;
headcode: string;
@ -6,7 +5,6 @@ export interface Detail {
uid: string;
}
// Initiates/Resets a `Detail` interface
export function detailInit(): Detail {
const detail: Detail = {
show: false,
@ -17,7 +15,6 @@ export function detailInit(): Detail {
return detail;
}
// Initiates/Updates a `Detail` interface using the given values
export function defineDetail(rid: string, uid: string, tid: string) {
const detail: Detail = {
rid: rid,