refactor: add typescript support to project

This commit is contained in:
HD
2022-06-21 15:08:35 +08:00
parent 88ec2b742a
commit bd799ebea8
259 changed files with 1042 additions and 458 deletions
@@ -1,6 +1,5 @@
import { useEffect } from "react";
import { useNavigate } from "react-router-dom";
// import toast, { Toaster } from 'react-hot-toast';
import useDeviceToken from "./useDeviceToken";
import { vapidKey } from "../../../app/config";
import { useUpdateDeviceTokenMutation } from "../../../app/services/auth";
@@ -16,7 +15,7 @@ const Notification = () => {
}, [token]);
useEffect(() => {
const handleServiceworkerMessage = (event) => {
const handleServiceworkerMessage = (event: MessageEvent) => {
const { newPath } = event.data;
navigateTo(newPath);
};
@@ -2,6 +2,7 @@ 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);
// https only
@@ -28,4 +29,5 @@ const useDeviceToken = (vapidKey) => {
}
return token;
};
export default useDeviceToken;