Skip to content
Snippets Groups Projects
Commit 60929892 authored by Nicolas Borboën's avatar Nicolas Borboën
Browse files

[feature] project config

parent 58ca4490
No related branches found
No related tags found
No related merge requests found
'use strict'
// https://stackoverflow.com/questions/44750008/vuejs-configuration-using-a-global-variable
module.exports = {
'API_LOCATION': process.env.NODE_ENV === 'production'
? 'https://canap-gest.epfl.ch/api'
: 'http://localhost:8181/api',
'LOGIN_REDIRECT': process.env.NODE_ENV === 'production'
? 'https://canap-gest.epfl.ch/api/auth/login'
: 'http://localhost:8181/api/auth/login',
}
import axios from 'axios'
import store from '@/store/store.js'
import router from '@/router/index.js'
import config from '../config'
const instance = axios.create({
headers: { 'Authorization': "Bearer " + localStorage.getItem('stored_token') },
baseURL: 'https://canap-gest.epfl.ch/api'
// baseURL: 'https://canap-gest.epfl.ch/api'
// baseURL: 'http://localhost:8181/api'
baseURL: config.API_LOCATION
})
instance.interceptors.response.use(function (response) {
......
import axios from '../../../plugins/axios'
import config from '../../../config'
export function login (context, key) {
if (key) {
......@@ -8,7 +9,9 @@ export function login (context, key) {
})
}
else {
window.location.href = "https://canap-gest.epfl.ch/api/auth/login"
//window.location.href = "https://canap-gest.epfl.ch/api/auth/login"
//window.location.href = "http://localhost:8181/api/auth/login"
window.location.href = config.LOGIN_REDIRECT
}
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment