@riligar/auth-react 1.19.1 → 1.20.0
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 +4 -0
- package/dist/index.esm.js +14 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +14 -12
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,9 @@
|
|
|
1
1
|
# Auth React
|
|
2
2
|
|
|
3
|
+
[](https://www.npmjs.com/package/@riligar/auth-react)
|
|
4
|
+
[](https://www.npmjs.com/package/@riligar/auth-react)
|
|
5
|
+
[](https://www.npmjs.com/package/@riligar/auth-react)
|
|
6
|
+
|
|
3
7
|
Auth SDK for React with JWT and JWKS.
|
|
4
8
|
|
|
5
9
|
## Installation
|
package/dist/index.esm.js
CHANGED
|
@@ -350,7 +350,7 @@ const useAuthStore = create((set, get) => ({
|
|
|
350
350
|
changePassword: false,
|
|
351
351
|
changeEmail: false,
|
|
352
352
|
listSessions: false,
|
|
353
|
-
revokeSession:
|
|
353
|
+
revokeSession: null // null or sessionId being revoked
|
|
354
354
|
},
|
|
355
355
|
// Application info (logo, nome, etc)
|
|
356
356
|
applicationInfo: null,
|
|
@@ -694,7 +694,7 @@ const useAuthStore = create((set, get) => ({
|
|
|
694
694
|
sessions,
|
|
695
695
|
signOut
|
|
696
696
|
} = get();
|
|
697
|
-
setLoading('revokeSession',
|
|
697
|
+
setLoading('revokeSession', sessionId);
|
|
698
698
|
set({
|
|
699
699
|
error: null
|
|
700
700
|
});
|
|
@@ -708,19 +708,21 @@ const useAuthStore = create((set, get) => ({
|
|
|
708
708
|
await signOut();
|
|
709
709
|
// signOut já limpa loading states e erros no finally, mas
|
|
710
710
|
// como estamos dentro do fluxo deste método, garantimos:
|
|
711
|
-
setLoading('revokeSession',
|
|
711
|
+
setLoading('revokeSession', null);
|
|
712
712
|
return;
|
|
713
713
|
}
|
|
714
714
|
await revokeSession(sessionId);
|
|
715
715
|
|
|
716
|
-
//
|
|
717
|
-
|
|
718
|
-
|
|
716
|
+
// Remove a sessão revogada da lista local
|
|
717
|
+
set(state => ({
|
|
718
|
+
sessions: state.sessions.filter(s => s.id !== sessionId)
|
|
719
|
+
}));
|
|
720
|
+
setLoading('revokeSession', null);
|
|
719
721
|
} catch (err) {
|
|
720
722
|
set({
|
|
721
723
|
error: err
|
|
722
724
|
});
|
|
723
|
-
setLoading('revokeSession',
|
|
725
|
+
setLoading('revokeSession', null);
|
|
724
726
|
throw err;
|
|
725
727
|
}
|
|
726
728
|
},
|
|
@@ -729,7 +731,7 @@ const useAuthStore = create((set, get) => ({
|
|
|
729
731
|
setLoading,
|
|
730
732
|
listSessions
|
|
731
733
|
} = get();
|
|
732
|
-
setLoading('revokeSession',
|
|
734
|
+
setLoading('revokeSession', 'all');
|
|
733
735
|
set({
|
|
734
736
|
error: null
|
|
735
737
|
});
|
|
@@ -737,12 +739,12 @@ const useAuthStore = create((set, get) => ({
|
|
|
737
739
|
await revokeOtherSessions();
|
|
738
740
|
// Refresh sessions list after revocation
|
|
739
741
|
await listSessions();
|
|
740
|
-
setLoading('revokeSession',
|
|
742
|
+
setLoading('revokeSession', null);
|
|
741
743
|
} catch (err) {
|
|
742
744
|
set({
|
|
743
745
|
error: err
|
|
744
746
|
});
|
|
745
|
-
setLoading('revokeSession',
|
|
747
|
+
setLoading('revokeSession', null);
|
|
746
748
|
throw err;
|
|
747
749
|
}
|
|
748
750
|
},
|
|
@@ -2911,7 +2913,7 @@ function UserProfile({
|
|
|
2911
2913
|
color: "red",
|
|
2912
2914
|
size: "xs",
|
|
2913
2915
|
onClick: () => handleRevokeSession(sessionItem.id),
|
|
2914
|
-
loading: loadingRevokeSession,
|
|
2916
|
+
loading: loadingRevokeSession === sessionItem.id,
|
|
2915
2917
|
leftSection: /*#__PURE__*/jsx(IconLogout, {
|
|
2916
2918
|
size: 14
|
|
2917
2919
|
}),
|
|
@@ -2927,7 +2929,7 @@ function UserProfile({
|
|
|
2927
2929
|
color: "red",
|
|
2928
2930
|
size: "xs",
|
|
2929
2931
|
onClick: handleRevokeOtherSessions,
|
|
2930
|
-
loading: loadingRevokeSession,
|
|
2932
|
+
loading: loadingRevokeSession === 'all',
|
|
2931
2933
|
leftSection: /*#__PURE__*/jsx(IconLogout, {
|
|
2932
2934
|
size: 14
|
|
2933
2935
|
}),
|