{"version":3,"sources":["webpack:///./src/apps/RouterApp.js"],"names":["Vue","use","Buefy","VueResource","headers","Accept","ApiAuth","addAuthHeader","k","http","common","app","el","methods","data","account","token","redirect","mounted","acct","document","getElementById","JSON","parse","value","saveToken","access_token","urlBase","Apollo","resolveAppUrl","redirectLocation","redirectUrl","trim","window","location","href"],"mappings":";;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA;AACA;AACA;;AAEAA,oDAAGA,CAACC,GAAJ,CAAQC,sDAAR;AACAF,oDAAGA,CAACC,GAAJ,CAAQE,6DAAR;;AAEA;AACA,IAAIC,UAAU,EAAEC,QAAQ,kBAAV,EAAd;AACAC,mEAAOA,CAACC,aAAR,CAAsBH,OAAtB;;AAEA,KAAK,IAAII,CAAT,IAAcJ,OAAd,EAAuB;AACnBJ,wDAAGA,CAACS,IAAJ,CAASL,OAAT,CAAiBM,MAAjB,CAAwBF,CAAxB,IAA6BJ,QAAQI,CAAR,CAA7B;AACH;;AAGD,IAAIG,MAAM,IAAIX,oDAAJ,CAAQ;AACdY,QAAI,aADU;AAEdC,aAAS,EAFK;AAIdC,UAAM;AACFC,iBAAS,IADP;AAEFC,eAAO,IAFL;AAGFC,kBAAU;AAHR,KAJQ;AASdC,WATc,qBASJ;AACN;AACA,YAAIC,OAAOC,SAASC,cAAT,CAAwB,OAAxB,CAAX;AACA;AACA,YAAIJ,WAAWG,SAASC,cAAT,CAAwB,UAAxB,CAAf;AACA,YAAIL,QAAQM,KAAKC,KAAL,CAAWJ,KAAKK,KAAhB,CAAZ;AACAP,mBAAWA,SAASO,KAApB;AACA;AACAlB,2EAAOA,CAACmB,SAAR,CAAkBT,MAAMU,YAAxB;AACA;;AAEA,YAAIC,UAAUC,OAAOC,aAAP,CAAqB,GAArB,CAAd;AACA,YAAIC,mBAAmBF,OAAOC,aAAP,CAAqBZ,QAArB,CAAvB;AACA,YAAIc,cAAcJ,QAAQK,IAAR,KAAiBF,iBAAiBE,IAAjB,EAAnC;;AAEA;AACA;AACA;;AAEAC,eAAOC,QAAP,CAAgBC,IAAhB,GAAuBJ,WAAvB;AACH;AA7Ba,CAAR,CAAV,C","file":"static/js/RouterApp.js","sourcesContent":["import Vue from \"vue\";\r\nimport ApiAuth from \"../models/ApiAuth.js\";\r\nimport Buefy from 'buefy';\r\nimport VueResource from \"vue-resource\";\r\n\r\nVue.use(Buefy);\r\nVue.use(VueResource);\r\n\r\n// add to all vue-resource request headers\r\nvar headers = { Accept: \"application/json\" };\r\nApiAuth.addAuthHeader(headers);\r\n\r\nfor (var k in headers) {\r\n Vue.http.headers.common[k] = headers[k];\r\n}\r\n\r\n\r\nvar app = new Vue({\r\n el: \"#router-app\",\r\n methods: {\r\n },\r\n data: {\r\n account: null,\r\n token: null,\r\n redirect: null\r\n },\r\n mounted() {\r\n //the account data written to the page from razor\r\n var acct = document.getElementById(\"token\");\r\n //the redirect location written to the page from razor\r\n var redirect = document.getElementById(\"redirect\");\r\n var token = JSON.parse(acct.value);\r\n redirect = redirect.value;\r\n //save the token to the browser\r\n ApiAuth.saveToken(token.access_token);\r\n //send them to their destination\r\n \r\n var urlBase = Apollo.resolveAppUrl(\"~\");\r\n var redirectLocation = Apollo.resolveAppUrl(redirect);\r\n var redirectUrl = urlBase.trim() + redirectLocation.trim();\r\n\r\n //console.log(\"~\", Apollo.resolveAppUrl(\"~\"));\r\n //console.log(\"public/drugsearch\", Apollo.resolveAppUrl(\"public/drugsearch\"));\r\n //console.log(\"redirect value\", Apollo.resolveAppUrl(redirect));\r\n\r\n window.location.href = redirectUrl;\r\n }\r\n});\r\n\n\n\n// WEBPACK FOOTER //\n// ./src/apps/RouterApp.js"],"sourceRoot":""}