strapi-sdk-js 2.3.2-rc.0 → 2.3.2-rc.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +4 -23
- package/dist/index.mjs +5 -5
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -6,25 +6,6 @@ var qs = require('qs');
|
|
|
6
6
|
var Cookies = require('js-cookie');
|
|
7
7
|
var ufo = require('ufo');
|
|
8
8
|
|
|
9
|
-
function _interopNamespaceDefault(e) {
|
|
10
|
-
var n = Object.create(null);
|
|
11
|
-
if (e) {
|
|
12
|
-
Object.keys(e).forEach(function (k) {
|
|
13
|
-
if (k !== 'default') {
|
|
14
|
-
var d = Object.getOwnPropertyDescriptor(e, k);
|
|
15
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
16
|
-
enumerable: true,
|
|
17
|
-
get: function () { return e[k]; }
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
n.default = e;
|
|
23
|
-
return Object.freeze(n);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
var ufo__namespace = /*#__PURE__*/_interopNamespaceDefault(ufo);
|
|
27
|
-
|
|
28
9
|
function isBrowser() {
|
|
29
10
|
return typeof window !== "undefined";
|
|
30
11
|
}
|
|
@@ -62,11 +43,11 @@ class Strapi {
|
|
|
62
43
|
const _options = defu(options || {}, defaults);
|
|
63
44
|
this.options = {
|
|
64
45
|
..._options,
|
|
65
|
-
url:
|
|
66
|
-
prefix:
|
|
46
|
+
url: ufo.cleanDoubleSlashes(_options == null ? void 0 : _options.url),
|
|
47
|
+
prefix: ufo.cleanDoubleSlashes(_options == null ? void 0 : _options.prefix)
|
|
67
48
|
};
|
|
68
49
|
this.axios = axios.create({
|
|
69
|
-
baseURL:
|
|
50
|
+
baseURL: ufo.joinURL(this.options.url, this.options.prefix),
|
|
70
51
|
paramsSerializer: qs.stringify,
|
|
71
52
|
...this.options.axiosOptions
|
|
72
53
|
});
|
|
@@ -227,7 +208,7 @@ class Strapi {
|
|
|
227
208
|
* @returns string
|
|
228
209
|
*/
|
|
229
210
|
getProviderAuthenticationUrl(provider) {
|
|
230
|
-
return
|
|
211
|
+
return ufo.joinURL(this.options.url, this.options.prefix, "connect", provider);
|
|
231
212
|
}
|
|
232
213
|
/**
|
|
233
214
|
* Authenticate user with the token present on the URL or in `params`
|
package/dist/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@ import axios from 'axios';
|
|
|
2
2
|
import defu from 'defu';
|
|
3
3
|
import qs from 'qs';
|
|
4
4
|
import Cookies from 'js-cookie';
|
|
5
|
-
import
|
|
5
|
+
import { cleanDoubleSlashes, joinURL } from 'ufo';
|
|
6
6
|
|
|
7
7
|
function isBrowser() {
|
|
8
8
|
return typeof window !== "undefined";
|
|
@@ -41,11 +41,11 @@ class Strapi {
|
|
|
41
41
|
const _options = defu(options || {}, defaults);
|
|
42
42
|
this.options = {
|
|
43
43
|
..._options,
|
|
44
|
-
url:
|
|
45
|
-
prefix:
|
|
44
|
+
url: cleanDoubleSlashes(_options == null ? void 0 : _options.url),
|
|
45
|
+
prefix: cleanDoubleSlashes(_options == null ? void 0 : _options.prefix)
|
|
46
46
|
};
|
|
47
47
|
this.axios = axios.create({
|
|
48
|
-
baseURL:
|
|
48
|
+
baseURL: joinURL(this.options.url, this.options.prefix),
|
|
49
49
|
paramsSerializer: qs.stringify,
|
|
50
50
|
...this.options.axiosOptions
|
|
51
51
|
});
|
|
@@ -206,7 +206,7 @@ class Strapi {
|
|
|
206
206
|
* @returns string
|
|
207
207
|
*/
|
|
208
208
|
getProviderAuthenticationUrl(provider) {
|
|
209
|
-
return
|
|
209
|
+
return joinURL(this.options.url, this.options.prefix, "connect", provider);
|
|
210
210
|
}
|
|
211
211
|
/**
|
|
212
212
|
* Authenticate user with the token present on the URL or in `params`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "strapi-sdk-js",
|
|
3
|
-
"version": "2.3.2-rc.
|
|
3
|
+
"version": "2.3.2-rc.2",
|
|
4
4
|
"description": "📦 Javascript SDK for your Strapi API",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"strapi",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
],
|
|
52
52
|
"scripts": {
|
|
53
53
|
"start": "rollup -c --watch",
|
|
54
|
-
"build": "rollup -c",
|
|
54
|
+
"build": "rm -rf dist && rollup -c",
|
|
55
55
|
"clean": "rm -rf bin dist coverage",
|
|
56
56
|
"lint": "eslint . --ext .ts,.js",
|
|
57
57
|
"lint:fix": "eslint . --ext .ts,.js --fix",
|