Skip to content

Commit

Permalink
Experimenting with production API base urls
Browse files Browse the repository at this point in the history
  • Loading branch information
stevespringett committed Jan 1, 2020
1 parent b997157 commit ad46353
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 31 deletions.
18 changes: 0 additions & 18 deletions public/index.jsp

This file was deleted.

13 changes: 1 addition & 12 deletions src/shared/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,7 @@
* avoid typographical errors.
*/

//const BASE_URL = process.env.NODE_ENV === "production" ? process.env.VUE_APP_SERVER_URL : "";

let contextPath = function contextPath() {
if (process.env.NODE_ENV === "production") {
let path = document.head.querySelector("[name=context-path]").content;
return (path.substr(-1) === '/') ? path : path + "/";
} else {
return "";
}
};

const BASE_URL = contextPath();
const BASE_URL = "";

// API Behavior
const CONTENT_TYPE_JSON = "application/json";
Expand Down
3 changes: 2 additions & 1 deletion vue.config.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
module.exports = {
lintOnSave: false,
runtimeCompiler: true,
publicPath: "/",
//publicPath: "/",
publicPath: process.env.NODE_ENV === 'production' ? '.' : '/',
devServer: {
proxy: { "/api": { target: process.env.VUE_APP_SERVER_URL } }
}
Expand Down

0 comments on commit ad46353

Please sign in to comment.