@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/dist/index.js
CHANGED
|
@@ -353,7 +353,7 @@ const useAuthStore = zustand.create((set, get) => ({
|
|
|
353
353
|
changePassword: false,
|
|
354
354
|
changeEmail: false,
|
|
355
355
|
listSessions: false,
|
|
356
|
-
revokeSession:
|
|
356
|
+
revokeSession: null // null or sessionId being revoked
|
|
357
357
|
},
|
|
358
358
|
// Application info (logo, nome, etc)
|
|
359
359
|
applicationInfo: null,
|
|
@@ -697,7 +697,7 @@ const useAuthStore = zustand.create((set, get) => ({
|
|
|
697
697
|
sessions,
|
|
698
698
|
signOut
|
|
699
699
|
} = get();
|
|
700
|
-
setLoading('revokeSession',
|
|
700
|
+
setLoading('revokeSession', sessionId);
|
|
701
701
|
set({
|
|
702
702
|
error: null
|
|
703
703
|
});
|
|
@@ -711,19 +711,21 @@ const useAuthStore = zustand.create((set, get) => ({
|
|
|
711
711
|
await signOut();
|
|
712
712
|
// signOut já limpa loading states e erros no finally, mas
|
|
713
713
|
// como estamos dentro do fluxo deste método, garantimos:
|
|
714
|
-
setLoading('revokeSession',
|
|
714
|
+
setLoading('revokeSession', null);
|
|
715
715
|
return;
|
|
716
716
|
}
|
|
717
717
|
await revokeSession(sessionId);
|
|
718
718
|
|
|
719
|
-
//
|
|
720
|
-
|
|
721
|
-
|
|
719
|
+
// Remove a sessão revogada da lista local
|
|
720
|
+
set(state => ({
|
|
721
|
+
sessions: state.sessions.filter(s => s.id !== sessionId)
|
|
722
|
+
}));
|
|
723
|
+
setLoading('revokeSession', null);
|
|
722
724
|
} catch (err) {
|
|
723
725
|
set({
|
|
724
726
|
error: err
|
|
725
727
|
});
|
|
726
|
-
setLoading('revokeSession',
|
|
728
|
+
setLoading('revokeSession', null);
|
|
727
729
|
throw err;
|
|
728
730
|
}
|
|
729
731
|
},
|
|
@@ -732,7 +734,7 @@ const useAuthStore = zustand.create((set, get) => ({
|
|
|
732
734
|
setLoading,
|
|
733
735
|
listSessions
|
|
734
736
|
} = get();
|
|
735
|
-
setLoading('revokeSession',
|
|
737
|
+
setLoading('revokeSession', 'all');
|
|
736
738
|
set({
|
|
737
739
|
error: null
|
|
738
740
|
});
|
|
@@ -740,12 +742,12 @@ const useAuthStore = zustand.create((set, get) => ({
|
|
|
740
742
|
await revokeOtherSessions();
|
|
741
743
|
// Refresh sessions list after revocation
|
|
742
744
|
await listSessions();
|
|
743
|
-
setLoading('revokeSession',
|
|
745
|
+
setLoading('revokeSession', null);
|
|
744
746
|
} catch (err) {
|
|
745
747
|
set({
|
|
746
748
|
error: err
|
|
747
749
|
});
|
|
748
|
-
setLoading('revokeSession',
|
|
750
|
+
setLoading('revokeSession', null);
|
|
749
751
|
throw err;
|
|
750
752
|
}
|
|
751
753
|
},
|
|
@@ -2914,7 +2916,7 @@ function UserProfile({
|
|
|
2914
2916
|
color: "red",
|
|
2915
2917
|
size: "xs",
|
|
2916
2918
|
onClick: () => handleRevokeSession(sessionItem.id),
|
|
2917
|
-
loading: loadingRevokeSession,
|
|
2919
|
+
loading: loadingRevokeSession === sessionItem.id,
|
|
2918
2920
|
leftSection: /*#__PURE__*/jsxRuntime.jsx(iconsReact.IconLogout, {
|
|
2919
2921
|
size: 14
|
|
2920
2922
|
}),
|
|
@@ -2930,7 +2932,7 @@ function UserProfile({
|
|
|
2930
2932
|
color: "red",
|
|
2931
2933
|
size: "xs",
|
|
2932
2934
|
onClick: handleRevokeOtherSessions,
|
|
2933
|
-
loading: loadingRevokeSession,
|
|
2935
|
+
loading: loadingRevokeSession === 'all',
|
|
2934
2936
|
leftSection: /*#__PURE__*/jsxRuntime.jsx(iconsReact.IconLogout, {
|
|
2935
2937
|
size: 14
|
|
2936
2938
|
}),
|