Skip to content

Commit

Permalink
[#501] Web: Update trails URL.
Browse files Browse the repository at this point in the history
Can't fix this currently because its the changes are in a incomplete PR atm, will update properly once that PR is merged.
  • Loading branch information
a-stacey committed Sep 4, 2019
1 parent cc14728 commit c0529fe
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 9 deletions.
7 changes: 6 additions & 1 deletion projects/web/src/components/submitTrail.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ import { Link } from "react-router-dom";
import { myGlobals } from "../globals";

import { AuthState } from "../auth";
import { Organisation } from "../business-registry";

export interface QueryProps {
authState: AuthState;
organisation: Organisation;
}

export function SubmitTrail(props: QueryProps) {
Expand All @@ -22,7 +24,10 @@ export function SubmitTrail(props: QueryProps) {

const submitTrail = () => {

return fetch(myGlobals.trailsUrl + '/trail', {
// TODO: The URL here needs to be changed to props.organisation.url, but the
// EDAPI that this is currently building against doesn't support the trails
// service yet.
return fetch('http://localhost:8300' + '/trail', {
method: 'POST',
body: JSON.stringify(trailEntry),
headers: {
Expand Down
4 changes: 0 additions & 4 deletions projects/web/src/globals.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
declare const OR_SERVICE_URL: string;
export const orUrl: string = OR_SERVICE_URL;

declare const TRAILS_SERVICE_URL: string;
export const trailsUrl: string = TRAILS_SERVICE_URL;

declare const GOOGLE_MAPS_API_KEY: string;
export const googleMapsApiKey: string = GOOGLE_MAPS_API_KEY;

export const myGlobals = {
edapiUrl: 'http://localhost:8020' as string,
orUrl: OR_SERVICE_URL as string,
trailsUrl : TRAILS_SERVICE_URL as string,
googleMapsApiKey: GOOGLE_MAPS_API_KEY as string,
};
2 changes: 1 addition & 1 deletion projects/web/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ authInit().then((authState) => {
<Submit authState={appState.auth} organisation={appState.organisation} ></Submit>} />

<Route path="/submitTrail" exact render={() =>
<SubmitTrail authState={appState.auth} ></SubmitTrail>} />
<SubmitTrail authState={appState.auth} organisation={appState.organisation} ></SubmitTrail>} />

<Route path="/scan/:scanData*" exact render={({ match }) =>
<Scan authState={appState.auth}
Expand Down
3 changes: 0 additions & 3 deletions projects/web/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,6 @@ module.exports = (env) => {
'OR_SERVICE_URL': JSON.stringify(env.production
? 'https://registry.mirza.d61.io'
: 'http://localhost:8200'),
'TRAILS_SERVICE_URL': JSON.stringify(env.production
? 'https://trails.mirza.d61.io'
: 'http://localhost:8300'),
'GOOGLE_MAPS_API_KEY': JSON.stringify(process.env.GOOGLE_MAPS_API_KEY),
}),
]
Expand Down

0 comments on commit c0529fe

Please sign in to comment.