@@ -2,6 +2,7 @@ import Vue from 'vue'
22import App from './App.vue'
33import router from './router'
44import store from './store'
5+ import { api } from './utils/api'
56import { BootstrapVue , BootstrapVueIcons } from 'bootstrap-vue'
67import VueCookies from 'vue-cookies'
78import vueCountryRegionSelect from 'vue-country-region-select'
@@ -126,7 +127,7 @@ new Vue({
126127 } ) ,
127128 data ( ) {
128129 return {
129- api : process . env . VUE_APP_BASE_API_URL ,
130+ api : api ,
130131 authenticated : false
131132 }
132133 } ,
@@ -172,9 +173,10 @@ new Vue({
172173 this . $cookies . remove ( 'Health_Auth' )
173174 } ,
174175 apiGETRequest ( endpoint , callback ) {
176+ const fullUrl = new URL ( endpoint , api )
175177 let self = this
176178 axios
177- . get ( self . api + endpoint , {
179+ . get ( fullUrl . toString ( ) , {
178180 headers : {
179181 'token' : self . getSavedToken ( )
180182 } ,
@@ -187,9 +189,10 @@ new Vue({
187189 } )
188190 } ,
189191 apiPUTRequest ( endpoint , payload , callback ) {
192+ const fullUrl = new URL ( endpoint , api )
190193 let self = this
191194 axios
192- . put ( self . api + endpoint , payload , {
195+ . put ( fullUrl . toString ( ) , payload , {
193196 headers : {
194197 'token' : self . getSavedToken ( )
195198 } ,
@@ -202,9 +205,10 @@ new Vue({
202205 } )
203206 } ,
204207 apiPOSTRequest ( endpoint , payload , callback ) {
208+ const fullUrl = new URL ( endpoint , api )
205209 let self = this
206210 axios
207- . post ( self . api + endpoint , payload , {
211+ . post ( fullUrl . toString ( ) , payload , {
208212 headers : {
209213 'token' : self . getSavedToken ( )
210214 } ,
@@ -218,10 +222,11 @@ new Vue({
218222 } )
219223 } ,
220224 apiDELRequest ( endpoint , callback ) {
225+ const fullUrl = new URL ( endpoint , api )
221226 let self = this
222227 // requirement for axios
223228 axios
224- . delete ( self . api + endpoint , {
229+ . delete ( fullUrl . toString ( ) , {
225230 headers : {
226231 'token' : self . getSavedToken ( )
227232 } ,
0 commit comments