jscdn.ink/dist/lib/fetch.js

16 lines
319 B
JavaScript

import fetch from 'fetch'
fetch.BASE_URL = '//api.jscdn.ink'
fetch.inject.request(function (conf) {
var token = localStorage.getItem('token')
conf.headers['content-type'] = 'application/json'
if (token) {
conf.headers.authorization = token
}
})
fetch.inject.response(r => r.json())
export default fetch
免费、快速、开放的 JS CDN 服务 https://www.jscdn.ink/