diff --git a/src/auth.js b/src/auth.js index 35e5e6d6ede18c134f93ae3e087d5a0dc83705eb..5f6159b19a1da98f9c30da7178d2dfab6d852ec8 100644 --- a/src/auth.js +++ b/src/auth.js @@ -1,5 +1,6 @@ import axios from 'axios'; import * as localStorage from './localStorage'; +import { apiUrl } from './config.json'; // Object which stores the current login-state const APISession = { @@ -8,7 +9,7 @@ const APISession = { }; const amivapi = axios.create({ - baseURL: 'https://amiv-api.ethz.ch/', + baseURL: apiUrl, timeout: 10000, headers: { 'Content-Type': 'application/json' }, }); @@ -59,7 +60,7 @@ export function getSession() { checkAuthenticated().then((authenticated) => { if (authenticated) { const authenticatedSession = axios.create({ - baseURL: 'https://amiv-api.ethz.ch/', + baseURL: apiUrl, timeout: 10000, headers: { 'Content-Type': 'application/json', diff --git a/src/config.json b/src/config.json index 81a5a391d8e28a5b928c0c915869c39d21c3e2ca..8734870b9d0243f2dd9b930e36a88c9ddb1c14d4 100644 --- a/src/config.json +++ b/src/config.json @@ -1,4 +1,5 @@ { + "apiUrl": "https://amiv-api.ethz.ch/", "Users": { "keyDescriptors": { "legi": "Legi Number", diff --git a/src/views/editView.js b/src/views/editView.js index 182659eb7229f88e6470f1da52276e852d3997d8..f72aad176cb7e19618c7d8611dc6c611878da943 100644 --- a/src/views/editView.js +++ b/src/views/editView.js @@ -1,6 +1,7 @@ import Ajv from 'ajv'; import { ItemView } from './itemView'; import { getSession } from '../auth'; +import { apiUrl } from '../config.json'; const m = require('mithril'); @@ -53,7 +54,7 @@ export class EditView extends ItemView { }); } // load schema - m.request('http://amiv-api.ethz.ch/docs/api-docs').then((schema) => { + m.request(`${apiUrl}docs/api-docs`).then((schema) => { const objectSchema = schema.definitions[ objectNameForResource[this.resource]]; this.ajv.addSchema(objectSchema, 'schema');