upgrade to 1.1.0
This commit is contained in:
1 parent
02c95d89bb
commit
f5893a107d
46 files changed
+3764
-2891
No files matched your search
Vendored
+16
@@ -0,0 +1,16 @@
|
||||
"use strict";
|
||||
const axios = require('axios');
|
||||
const { getConfig } = require('./config.js');
|
||||
function _getUrl(path) {
|
||||
const cfg = getConfig();
|
||||
return `${cfg.apiUrl}${path}`;
|
||||
}
|
||||
function _headers(token) {
|
||||
return {
|
||||
'Authorization': `Bearer ${token || getConfig().apiKey}`,
|
||||
};
|
||||
}
|
||||
async function auth({ subject, action, resource }) {
|
||||
return (await axios.post(_getUrl('/api/v1/auth'), { subject, action, resource }, { headers: _headers() })).data;
|
||||
}
|
||||
module.exports = { auth };
|
||||
Reference in new issue
Block a user