refactor: more TS code
This commit is contained in:
@@ -2,9 +2,8 @@ import { useState } from "react";
|
||||
import { initializeApp } from "firebase/app";
|
||||
import { getToken, getMessaging } from "firebase/messaging";
|
||||
import { firebaseConfig } from "../../../app/config";
|
||||
|
||||
const useDeviceToken = (vapidKey) => {
|
||||
const [token, setToken] = useState(null);
|
||||
const useDeviceToken = (vapidKey: string) => {
|
||||
const [token, setToken] = useState<string | null>(null);
|
||||
// https only
|
||||
if (navigator.serviceWorker) {
|
||||
const messaging = getMessaging(initializeApp(firebaseConfig));
|
||||
@@ -17,7 +16,7 @@ const useDeviceToken = (vapidKey) => {
|
||||
console.log("current token for client: ", currentToken);
|
||||
setToken(currentToken);
|
||||
// updateDeviceToken(currentToken)
|
||||
// Perform any other neccessary action with the token
|
||||
// Perform any other necessary action with the token
|
||||
} else {
|
||||
// Show permission request UI
|
||||
console.log("No registration token available. Request permission to generate one.");
|
||||
|
||||
Reference in New Issue
Block a user