From a1e6a95f13c8a2fdc81e4ff9e414b75d46c36093 Mon Sep 17 00:00:00 2001 From: Etienne Dldc Date: Sun, 19 Nov 2017 01:34:44 +0100 Subject: [PATCH] Make BASE_API more explicit & Fix typo --- CONTRIBUTING.md | 2 +- app-frontend/src/js/captain/apiManager.js | 9 +++++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 370c5b08..c8f230d0 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -62,7 +62,7 @@ Change the endpoint for the backend server to your debug instance by editing thi `/captainduckduck/app-frontend/src/js/captain/apiManager.js` and change `var BASE_API = '/api/v1/'` to - `var BASE_API = 'http://captain.captain.x/api/v1/'` if you have dnsmasq installed -- `var BASE_API = 'http://127.0.0.1:3000/api/v1/'` if you have dnsmasq installed +- `var BASE_API = 'http://127.0.0.1:3000/api/v1/'` if you don't have dnsmasq installed You need to hardcode a logged in user to avoid having to log it with every refresh of the page. To do so, steal the auth token from the the network inspector on Chrome and hardcode it in apiManager.js. You can simply replace `var authToken = null` with `var authToken = 'THE_AUTH_TOKEN_STOLEN_FROM_NETWORK_INSPECTOR'` diff --git a/app-frontend/src/js/captain/apiManager.js b/app-frontend/src/js/captain/apiManager.js index b8585f27..2ddd7d4e 100644 --- a/app-frontend/src/js/captain/apiManager.js +++ b/app-frontend/src/js/captain/apiManager.js @@ -2,11 +2,16 @@ angular.module('RDash') .factory('apiManager', ApiManager); - - var BASE_API = '/api/v1/'; // 'http://captain.captain.x/'; + var BASE_API = '/api/v1/'; var TOKEN_HEADER = 'x-captain-auth'; var NAMESPACE = 'x-namespace'; var CAPTAIN = 'captain'; + + // In developement + // Uncomment the following line if you have dnsmasq installed + // BASE_API = 'http://captain.captain.x/api/v1'; + // Uncomment the following line if you don't have dnsmasq installed + // BASE_API = 'http://127.0.0.1:3000/api/v1/'; function ApiManager(captainLogger, $http, $timeout) {