diff options
author | 2018-06-27 16:32:53 +0300 | |
---|---|---|
committer | 2023-01-13 10:37:53 +0300 | |
commit | 660cc823d4f2446dbc3113b2de4d3164664303fb (patch) | |
tree | ad6b807841a926313806892e2410f7932d717837 /vnext/src/api | |
parent | 930736e7b3ff29de16aaec9229242bd83c09f3b7 (diff) |
fix social login
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) |