aboutsummaryrefslogtreecommitdiff
path: root/vnext/src/api
diff options
context:
space:
mode:
Diffstat (limited to 'vnext/src/api')
-rw-r--r--vnext/src/api/index.js8
1 files changed, 5 insertions, 3 deletions
diff --git a/vnext/src/api/index.js b/vnext/src/api/index.js
index d5fb6ba7..2392bfd0 100644
--- a/vnext/src/api/index.js
+++ b/vnext/src/api/index.js
@@ -1,5 +1,5 @@
import axios from 'axios';
-import cookies from 'react-cookies';
+import Cookies from 'universal-cookie';
const apiBaseUrl = 'https://juick.com';
@@ -71,8 +71,9 @@ const client = axios.create({
baseURL: apiBaseUrl
});
client.interceptors.request.use(config => {
+ let cookies = new Cookies();
config.params = Object.assign(config.params || {}, {
- hash: cookies.load('hash')
+ hash: cookies.get('hash')
});
return config;
});
@@ -84,6 +85,7 @@ client.interceptors.request.use(config => {
* @return {Promise<SecureUser, Error>} me object
*/
export function me(username = '', password = '') {
+ let cookies = new Cookies();
return new Promise((resolve, reject) => {
client.get('/api/me', {
headers: username ? {
@@ -91,7 +93,7 @@ export function me(username = '', password = '') {
} : {}
}).then(response => {
let visitor = response.data;
- cookies.save('hash', visitor.hash, { path: '/' });
+ cookies.set('hash', visitor.hash, { path: '/' });
resolve(visitor);
}).catch(reason => {
cookies.remove('hash', { path: '/'});