sevago-sso-fe 1.0.0 → 1.0.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/README.md +3 -13
- package/dist/index.cjs.js +22 -6
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.esm.js +22 -6
- package/dist/index.esm.js.map +1 -1
- package/package.json +8 -7
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {}
|
package/dist/index.esm.js
CHANGED
|
@@ -31901,7 +31901,10 @@ function App() {
|
|
|
31901
31901
|
try {
|
|
31902
31902
|
account.user && await dispatch(ACTION_ACCOUNT.getAccount(account.user.id)).unwrap();
|
|
31903
31903
|
} catch (error) {
|
|
31904
|
-
showSnackbar({
|
|
31904
|
+
showSnackbar({
|
|
31905
|
+
message: getErrorMessage(error),
|
|
31906
|
+
type: SnackbarType.ERROR
|
|
31907
|
+
});
|
|
31905
31908
|
}
|
|
31906
31909
|
})();
|
|
31907
31910
|
}, []);
|
|
@@ -31909,7 +31912,9 @@ function App() {
|
|
|
31909
31912
|
(async () => {
|
|
31910
31913
|
try {
|
|
31911
31914
|
if (!("serviceWorker" in navigator)) return;
|
|
31912
|
-
const registration = await navigator.serviceWorker.register(
|
|
31915
|
+
const registration = await navigator.serviceWorker.register(
|
|
31916
|
+
"/firebase-messaging-sw.js"
|
|
31917
|
+
);
|
|
31913
31918
|
await navigator.serviceWorker.ready;
|
|
31914
31919
|
const permission = await Notification.requestPermission();
|
|
31915
31920
|
if (permission === "granted" && account.isLogin && !account.fcmToken) {
|
|
@@ -31917,10 +31922,16 @@ function App() {
|
|
|
31917
31922
|
vapidKey: void 0,
|
|
31918
31923
|
serviceWorkerRegistration: registration
|
|
31919
31924
|
});
|
|
31920
|
-
if (fcmToken)
|
|
31925
|
+
if (fcmToken)
|
|
31926
|
+
await dispatch(
|
|
31927
|
+
ACTION_ACCOUNT.subscribeTopic({ fcmToken })
|
|
31928
|
+
).unwrap();
|
|
31921
31929
|
}
|
|
31922
31930
|
} catch (error) {
|
|
31923
|
-
showSnackbar({
|
|
31931
|
+
showSnackbar({
|
|
31932
|
+
message: getErrorMessage(error),
|
|
31933
|
+
type: SnackbarType.ERROR
|
|
31934
|
+
});
|
|
31924
31935
|
}
|
|
31925
31936
|
})();
|
|
31926
31937
|
}, [account.isLogin]);
|
|
@@ -31929,8 +31940,13 @@ function App() {
|
|
|
31929
31940
|
if (!event.data) return;
|
|
31930
31941
|
const { title, message } = event.data;
|
|
31931
31942
|
const currentCount = store.getState().account.notificationCount;
|
|
31932
|
-
await dispatch(
|
|
31933
|
-
|
|
31943
|
+
await dispatch(
|
|
31944
|
+
ACTION_ACCOUNT.changeNotificationCount(currentCount + 1)
|
|
31945
|
+
).unwrap();
|
|
31946
|
+
showSnackbar({
|
|
31947
|
+
message: `${title}: ${message}`,
|
|
31948
|
+
type: SnackbarType.INFO
|
|
31949
|
+
});
|
|
31934
31950
|
};
|
|
31935
31951
|
navigator.serviceWorker.addEventListener("message", handler);
|
|
31936
31952
|
return () => {
|