directus-sdk-javascript
Advanced tools
Comparing version 3.0.0-18 to 3.0.0-19
{ | ||
"name": "directus-sdk-javascript", | ||
"version": "3.0.0-18", | ||
"version": "3.0.0-19", | ||
"description": "WIP - Directus SDK for JavaScript (Node and Browser)", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -107,14 +107,17 @@ const axios = require('axios'); | ||
// Delete access token in case it still contained an expired one | ||
this.accessToken = null; | ||
this.getToken({ email, password }) | ||
.then(res => res.data) | ||
.then(data => { | ||
this.accessToken = data.token; | ||
.then(res => res.data) | ||
.then(data => { | ||
this.accessToken = data.token; | ||
this.emit('login:success'); | ||
resolve(); | ||
}) | ||
.catch((error) => { | ||
this.emit('login:failed', error); | ||
reject(error); | ||
}); | ||
this.emit('login:success'); | ||
resolve(); | ||
}) | ||
.catch((error) => { | ||
this.emit('login:failed', error); | ||
reject(error); | ||
}); | ||
}); | ||
@@ -131,3 +134,3 @@ } | ||
refresh(token) { | ||
refresh(token = null) { | ||
this.accessToken = token; | ||
@@ -193,10 +196,8 @@ | ||
getPreferences(collection, user, params = {}) { | ||
params = Object.assign(params, { | ||
'filter[title][null]': null, | ||
'filter[collection][eq]': collection, | ||
'filter[user][eq]': user, | ||
}); | ||
getFields(collection, params = {}) { | ||
return this.request('get', `fields/${collection}`, params); | ||
} | ||
return this.request('get', `collection_presets/${collection}`); | ||
getSettings(params = {}) { | ||
return this.request('get', 'settings', params); | ||
} | ||
@@ -203,0 +204,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
41657