Skip to content

Commit

Permalink
fix: configure Axios for dynamic baseURL
Browse files Browse the repository at this point in the history
  • Loading branch information
vanekj committed Aug 22, 2020
1 parent df27612 commit be314bc
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion app/nuxt.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,8 @@ module.exports = {
'@nuxtjs/axios'
],
plugins: [
'@/plugins/filters.js'
'@/plugins/axios',
'@/plugins/filters'
],
srcDir: './app/shared'
};
6 changes: 6 additions & 0 deletions app/shared/plugins/axios.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
export default function({ $axios }) {
if (process.client) {
$axios.defaults.baseURL = window.location.origin;
console.log($axios.defaults.baseURL);
}
}

0 comments on commit be314bc

Please sign in to comment.