From 3d7e6cf52f391a647e732d52bc97d538c5ab2ca9 Mon Sep 17 00:00:00 2001 From: williameriksson126 Date: Tue, 8 Dec 2020 09:36:19 +0100 Subject: [PATCH] Add: json files for scenarios --- src/APIexamples/disruption1.json | 15 +++++++++++++++ src/APIexamples/disruption2.json | 11 +++++++++++ src/APIexamples/user1.json | 5 +++++ src/APIexamples/user2.json | 5 +++++ src/APIexamples/user3.json | 5 +++++ src/APIexamples/user4.json | 5 +++++ src/classes/Coordinates.js | 2 +- src/classes/disruption.js | 11 +++++++++++ src/components/NearbyStation.js | 1 + 9 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 src/APIexamples/disruption1.json create mode 100644 src/APIexamples/disruption2.json create mode 100644 src/APIexamples/user1.json create mode 100644 src/APIexamples/user2.json create mode 100644 src/APIexamples/user3.json create mode 100644 src/APIexamples/user4.json create mode 100644 src/classes/disruption.js diff --git a/src/APIexamples/disruption1.json b/src/APIexamples/disruption1.json new file mode 100644 index 0000000..17e823e --- /dev/null +++ b/src/APIexamples/disruption1.json @@ -0,0 +1,15 @@ +{ + "situationNumber": "RT1", + "severity":"normal", + "title":"Stannar inte på dessa hållplatser", + "affectedStopPoints":[ + { + "gid": "9022014014020001", + "name": "Ekelöv västra, Kungälv" + }, + { + "gid": "9022014014751001", + "name": "Guddeby, Kungälv" + } + ] +} \ No newline at end of file diff --git a/src/APIexamples/disruption2.json b/src/APIexamples/disruption2.json new file mode 100644 index 0000000..9928f49 --- /dev/null +++ b/src/APIexamples/disruption2.json @@ -0,0 +1,11 @@ +{ + "situationNumber": "RT2", + "severity":"normal", + "title":"Försening", + "affectedStopPoints":[ + { + "gid": "9021014014225000", + "name": "Skrämmenborg, Kungälv" + } + ] +} \ No newline at end of file diff --git a/src/APIexamples/user1.json b/src/APIexamples/user1.json new file mode 100644 index 0000000..0cb6458 --- /dev/null +++ b/src/APIexamples/user1.json @@ -0,0 +1,5 @@ +{ + "name":"1", + "deviceId":"1", + "location":"9022014014754001" +} \ No newline at end of file diff --git a/src/APIexamples/user2.json b/src/APIexamples/user2.json new file mode 100644 index 0000000..4429791 --- /dev/null +++ b/src/APIexamples/user2.json @@ -0,0 +1,5 @@ +{ + "name":"2", + "deviceId":"2", + "location":"9022014014020001" +} \ No newline at end of file diff --git a/src/APIexamples/user3.json b/src/APIexamples/user3.json new file mode 100644 index 0000000..4f5b8e2 --- /dev/null +++ b/src/APIexamples/user3.json @@ -0,0 +1,5 @@ +{ + "name":"3", + "deviceId":"3", + "location":"9022014014751001" +} \ No newline at end of file diff --git a/src/APIexamples/user4.json b/src/APIexamples/user4.json new file mode 100644 index 0000000..89089ba --- /dev/null +++ b/src/APIexamples/user4.json @@ -0,0 +1,5 @@ +{ + "name":"4", + "deviceId":"4", + "location":"9021014014225000" +} \ No newline at end of file diff --git a/src/classes/Coordinates.js b/src/classes/Coordinates.js index 53d48bf..b326afe 100644 --- a/src/classes/Coordinates.js +++ b/src/classes/Coordinates.js @@ -12,4 +12,4 @@ class Coordinates { } } -export default Coordinates; \ No newline at end of file +export default Coordinates; diff --git a/src/classes/disruption.js b/src/classes/disruption.js new file mode 100644 index 0000000..fbaf04a --- /dev/null +++ b/src/classes/disruption.js @@ -0,0 +1,11 @@ + +class Disruption { + constructor(situationNumber, severity, title, affectedStopPoints) { + this.situationNumber = situationNumber; + this.severity = severity; + this.title = title; + this.affectedStopPoints = affectedStopPoints; + } +} + +export default User; \ No newline at end of file diff --git a/src/components/NearbyStation.js b/src/components/NearbyStation.js index 7455c93..e231c51 100644 --- a/src/components/NearbyStation.js +++ b/src/components/NearbyStation.js @@ -1,6 +1,7 @@ import React from 'react'; import axios from 'axios'; import AccessToken from '../classes/AccessToken' +import json5 from 'json5'; class NearbyStation extends React.Component { state = {