Refresh HiveGrid Cloud reference snapshot
This commit is contained in:
1 parent
5e99e14772
commit
7f88026f79
5955 files changed
+1177325
-188362
No files matched your search
+34
@@ -0,0 +1,34 @@
|
||||
import { useEffect } from "react";
|
||||
|
||||
import { bootstrapTelephonyPush } from "~/lib/pwa/telephonyPush";
|
||||
|
||||
type TelephonyPushBootstrapProps = {
|
||||
enabled: boolean;
|
||||
tenantSlug: string;
|
||||
vapidPublicKey?: string;
|
||||
csrfToken?: string;
|
||||
isDev?: boolean;
|
||||
onError?: (error: unknown) => void;
|
||||
};
|
||||
|
||||
/** Non-visual bootstrap for users who have already granted Web Push. */
|
||||
export function TelephonyPushBootstrap({
|
||||
enabled,
|
||||
tenantSlug,
|
||||
vapidPublicKey,
|
||||
csrfToken,
|
||||
isDev,
|
||||
onError,
|
||||
}: TelephonyPushBootstrapProps): null {
|
||||
useEffect(() => {
|
||||
let active = true;
|
||||
void bootstrapTelephonyPush({ enabled, tenantSlug, vapidPublicKey, csrfToken, isDev }).catch((error: unknown) => {
|
||||
if (active) onError?.(error);
|
||||
});
|
||||
return () => {
|
||||
active = false;
|
||||
};
|
||||
}, [csrfToken, enabled, isDev, onError, tenantSlug, vapidPublicKey]);
|
||||
|
||||
return null;
|
||||
}
|
||||
Reference in new issue
Block a user