@ttoss/react-auth-strapi 0.4.31 → 0.4.33
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 +8 -8
- package/dist/index.mjs +8 -8
- package/package.json +11 -11
package/dist/index.cjs
CHANGED
|
@@ -36,16 +36,16 @@ react = __toESM(react);
|
|
|
36
36
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
37
37
|
|
|
38
38
|
//#region src/storage.ts
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
39
|
+
var AUTH_STORAGE_REFRESH_TOKEN_KEY = "ttoss-strapi-auth-refresh-token";
|
|
40
|
+
var isBrowser = typeof window !== "undefined";
|
|
41
|
+
var getLocalStorage = () => {
|
|
42
42
|
try {
|
|
43
43
|
return isBrowser ? window.localStorage : null;
|
|
44
44
|
} catch {
|
|
45
45
|
return null;
|
|
46
46
|
}
|
|
47
47
|
};
|
|
48
|
-
|
|
48
|
+
var storage = {
|
|
49
49
|
getRefreshToken: () => {
|
|
50
50
|
const ls = getLocalStorage();
|
|
51
51
|
if (!ls) return null;
|
|
@@ -73,10 +73,10 @@ const storage = {
|
|
|
73
73
|
|
|
74
74
|
//#endregion
|
|
75
75
|
//#region src/AuthProvider.tsx
|
|
76
|
-
|
|
76
|
+
var AuthContext = react.createContext({
|
|
77
77
|
apiUrl: ""
|
|
78
78
|
});
|
|
79
|
-
|
|
79
|
+
var AuthProvider = props => {
|
|
80
80
|
const getAuthData = react.useCallback(async () => {
|
|
81
81
|
try {
|
|
82
82
|
const refreshToken = storage.getRefreshToken();
|
|
@@ -136,7 +136,7 @@ const AuthProvider = props => {
|
|
|
136
136
|
})
|
|
137
137
|
});
|
|
138
138
|
};
|
|
139
|
-
|
|
139
|
+
var useAuth = () => {
|
|
140
140
|
const authCore = (0, _ttoss_react_auth_core.useAuth)();
|
|
141
141
|
const {
|
|
142
142
|
apiUrl
|
|
@@ -149,7 +149,7 @@ const useAuth = () => {
|
|
|
149
149
|
|
|
150
150
|
//#endregion
|
|
151
151
|
//#region src/Auth.tsx
|
|
152
|
-
|
|
152
|
+
var Auth = props => {
|
|
153
153
|
const {
|
|
154
154
|
setAuthData,
|
|
155
155
|
apiUrl
|
package/dist/index.mjs
CHANGED
|
@@ -5,16 +5,16 @@ import * as React from "react";
|
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
|
|
7
7
|
//#region src/storage.ts
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
var AUTH_STORAGE_REFRESH_TOKEN_KEY = "ttoss-strapi-auth-refresh-token";
|
|
9
|
+
var isBrowser = typeof window !== "undefined";
|
|
10
|
+
var getLocalStorage = () => {
|
|
11
11
|
try {
|
|
12
12
|
return isBrowser ? window.localStorage : null;
|
|
13
13
|
} catch {
|
|
14
14
|
return null;
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
|
|
17
|
+
var storage = {
|
|
18
18
|
getRefreshToken: () => {
|
|
19
19
|
const ls = getLocalStorage();
|
|
20
20
|
if (!ls) return null;
|
|
@@ -42,10 +42,10 @@ const storage = {
|
|
|
42
42
|
|
|
43
43
|
//#endregion
|
|
44
44
|
//#region src/AuthProvider.tsx
|
|
45
|
-
|
|
45
|
+
var AuthContext = React.createContext({
|
|
46
46
|
apiUrl: ""
|
|
47
47
|
});
|
|
48
|
-
|
|
48
|
+
var AuthProvider = props => {
|
|
49
49
|
const getAuthData = React.useCallback(async () => {
|
|
50
50
|
try {
|
|
51
51
|
const refreshToken = storage.getRefreshToken();
|
|
@@ -105,7 +105,7 @@ const AuthProvider = props => {
|
|
|
105
105
|
})
|
|
106
106
|
});
|
|
107
107
|
};
|
|
108
|
-
|
|
108
|
+
var useAuth = () => {
|
|
109
109
|
const authCore = useAuth$1();
|
|
110
110
|
const {
|
|
111
111
|
apiUrl
|
|
@@ -118,7 +118,7 @@ const useAuth = () => {
|
|
|
118
118
|
|
|
119
119
|
//#endregion
|
|
120
120
|
//#region src/Auth.tsx
|
|
121
|
-
|
|
121
|
+
var Auth = props => {
|
|
122
122
|
const {
|
|
123
123
|
setAuthData,
|
|
124
124
|
apiUrl
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ttoss/react-auth-strapi",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.33",
|
|
4
4
|
"description": "Authentication components and abstractions for React apps using Strapi.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"React",
|
|
@@ -36,19 +36,19 @@
|
|
|
36
36
|
"jest": "^30.3.0",
|
|
37
37
|
"react": "^19.2.6",
|
|
38
38
|
"tsdown": "^0.22.0",
|
|
39
|
-
"@ttoss/
|
|
40
|
-
"@ttoss/
|
|
41
|
-
"@ttoss/react-
|
|
42
|
-
"@ttoss/
|
|
43
|
-
"@ttoss/react-
|
|
44
|
-
"@ttoss/test-utils": "^4.2.
|
|
45
|
-
"@ttoss/ui": "^6.9.
|
|
39
|
+
"@ttoss/config": "^1.37.15",
|
|
40
|
+
"@ttoss/i18n-cli": "^0.8.15",
|
|
41
|
+
"@ttoss/react-auth-core": "^0.4.33",
|
|
42
|
+
"@ttoss/react-notifications": "^2.7.24",
|
|
43
|
+
"@ttoss/react-i18n": "^2.2.17",
|
|
44
|
+
"@ttoss/test-utils": "^4.2.15",
|
|
45
|
+
"@ttoss/ui": "^6.9.23"
|
|
46
46
|
},
|
|
47
47
|
"peerDependencies": {
|
|
48
48
|
"react": ">=16.8.0",
|
|
49
|
-
"@ttoss/react-auth-core": "^0.4.
|
|
50
|
-
"@ttoss/react-
|
|
51
|
-
"@ttoss/react-
|
|
49
|
+
"@ttoss/react-auth-core": "^0.4.33",
|
|
50
|
+
"@ttoss/react-notifications": "^2.7.24",
|
|
51
|
+
"@ttoss/react-i18n": "^2.2.17"
|
|
52
52
|
},
|
|
53
53
|
"publishConfig": {
|
|
54
54
|
"access": "public",
|