From 660cc823d4f2446dbc3113b2de4d3164664303fb Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Wed, 27 Jun 2018 16:32:53 +0300 Subject: fix social login --- vnext/src/api/index.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'vnext/src/api/index.js') 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) -- cgit v1.2.3