dauth-context-react 0.2.121 → 0.2.123
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/README.md +262 -39
- package/dist/dauth-context-react.cjs.development.js +47 -37
- package/dist/dauth-context-react.cjs.development.js.map +1 -1
- package/dist/dauth-context-react.cjs.production.min.js +1 -1
- package/dist/dauth-context-react.cjs.production.min.js.map +1 -1
- package/dist/dauth-context-react.esm.js +47 -37
- package/dist/dauth-context-react.esm.js.map +1 -1
- package/dist/initialDauthState.d.ts +1 -1
- package/package.json +2 -1
- package/src/api/utils/config.ts +17 -10
- package/src/api/utils/routes.ts +1 -1
- package/src/index.tsx +3 -3
- package/src/initialDauthState.ts +7 -2
- package/src/interfaces.ts +1 -1
- package/src/reducer/dauth.actions.ts +9 -5
|
@@ -42,7 +42,7 @@ export async function setDauthStateAction({
|
|
|
42
42
|
return resetUser(dispatch);
|
|
43
43
|
}
|
|
44
44
|
} catch (error) {
|
|
45
|
-
console.
|
|
45
|
+
console.error(error);
|
|
46
46
|
return resetUser(dispatch);
|
|
47
47
|
} finally {
|
|
48
48
|
dispatch({
|
|
@@ -69,7 +69,8 @@ export async function setAutoLoginAction({
|
|
|
69
69
|
token_ls
|
|
70
70
|
);
|
|
71
71
|
if (refreshAccessTokenFetch.response.status === 200) {
|
|
72
|
-
const
|
|
72
|
+
const newToken = refreshAccessTokenFetch.data.accessToken || token_ls;
|
|
73
|
+
const getUserFetch = await getUserAPI(domainName, newToken);
|
|
73
74
|
if (getUserFetch.response.status === 200) {
|
|
74
75
|
dispatch({
|
|
75
76
|
type: DauthTypes.LOGIN,
|
|
@@ -101,7 +102,7 @@ export async function setAutoLoginAction({
|
|
|
101
102
|
return resetUser(dispatch);
|
|
102
103
|
}
|
|
103
104
|
} catch (error) {
|
|
104
|
-
console.
|
|
105
|
+
console.error(error);
|
|
105
106
|
return resetUser(dispatch);
|
|
106
107
|
} finally {
|
|
107
108
|
dispatch({
|
|
@@ -165,11 +166,11 @@ export async function setUpdateUserAction({
|
|
|
165
166
|
});
|
|
166
167
|
return true;
|
|
167
168
|
} else {
|
|
168
|
-
console.
|
|
169
|
+
console.error('Update user error', getUserFetch.data.message);
|
|
169
170
|
return false;
|
|
170
171
|
}
|
|
171
172
|
} catch (error) {
|
|
172
|
-
console.
|
|
173
|
+
console.error('Update user error', error);
|
|
173
174
|
return false;
|
|
174
175
|
}
|
|
175
176
|
}
|
|
@@ -246,6 +247,9 @@ export async function checkTokenAction({
|
|
|
246
247
|
token
|
|
247
248
|
);
|
|
248
249
|
if (refreshAccessTokenFetch.response.status === 200) {
|
|
250
|
+
if (refreshAccessTokenFetch.data.accessToken) {
|
|
251
|
+
localStorage.setItem(TOKEN_LS, refreshAccessTokenFetch.data.accessToken);
|
|
252
|
+
}
|
|
249
253
|
return;
|
|
250
254
|
} else {
|
|
251
255
|
window.location.replace(
|