@websanova/vue-auth
Version:
A simple light-weight authentication library for Vue.js
7 lines (6 loc) • 837 B
JavaScript
/*!
* @websanova/vue-auth v4.2.1
* https://websanova.com/docs/vue-auth
* Released under the MIT License.
*/
!function(t,n){"object"==typeof exports&&"undefined"!=typeof module?module.exports=n():"function"==typeof define&&define.amd?define(n):t.VueAuth=n()}(this,function(){"use strict";return{init:function(){if(!this.plugins.http)return"drivers/http/vue-resource.1.x.js: http plugin has not been set."},interceptor:function(e,i){var r=this;this.plugins.http.interceptors.push(function(n,t){e&&e.call(r,n),t(function(t){i&&i.call(r,t,n)})})},invalidToken:function(t){if(401===t.status)return!0},httpData:function(t){return t.data||{}},http:function(t){return this.plugins.http(t)},getHeaders:function(t){var n,e={},i=t.headers.map;for(n in i)e[n]=i[n][0];return e},setHeaders:function(t,n){for(var e in n)t.headers.set(e,n[e])}}});