diff options
Diffstat (limited to 'vnext/src/api')
-rw-r--r-- | vnext/src/api/index.js | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/vnext/src/api/index.js b/vnext/src/api/index.js index 130a5dc2..b190bc48 100644 --- a/vnext/src/api/index.js +++ b/vnext/src/api/index.js @@ -12,12 +12,13 @@ client.interceptors.request.use(config => { return config; }) -export function auth(username, password) { +export function me(username = '', password = '') { return new Promise((resolve, reject) => { + client.get('/me', { - headers: { + headers: username ? { 'Authorization': 'Basic ' + window.btoa(unescape(encodeURIComponent(username + ":" + password))) - } + } : {} }).then(response => { localStorage.visitor = JSON.stringify(response.data); resolve(response.data) |