@@ -4,12 +4,10 @@ import axios from 'axios'
44import 'uno.css'
55import './assets/base.css'
66import { createHead } from '@vueuse/head'
7- import { onMessage } from 'firebase/messaging'
8- import router , { routes } from './router'
9- import { messaging } from './services/notifications'
10- import App from './App.vue'
117// import { onMessage } from 'firebase/messaging'
8+ import router , { routes } from './router'
129// import { messaging } from './services/notifications'
10+ import App from './App.vue'
1311
1412const meta = document . createElement ( 'meta' )
1513meta . name = 'naive-ui-style'
@@ -43,41 +41,44 @@ if (import.meta.hot)
4341 import . meta. hot . accept ( )
4442
4543init ( )
46- onMessage ( messaging , ( payload ) => {
47- if ( payload . notification === undefined )
48- return
44+ // TODO nullable Firebase messaging
45+ // if (import.meta.env.VITE_FIREBASE_CONFIG) {
46+ // onMessage(messaging, (payload) => {
47+ // if (payload.notification === undefined)
48+ // return
4949
50- // console.log(payload.data)
51- const notificationData = payload
50+ // // console.log(payload.data)
51+ // const notificationData = payload
5252
53- // eslint-disable-next-line no-console
54- console . log (
55- '[firebase-messaging-sw.js] Received foreground message ' ,
56- notificationData ,
57- )
58- const { tSuccess } = usePWebNotification ( )
59- if ( notificationData . data )
60- tSuccess ( { title : notificationData . data . title , description : notificationData . data . body } )
53+ // // eslint-disable-next-line no-console
54+ // console.log(
55+ // '[firebase-messaging-sw.js] Received foreground message ',
56+ // notificationData,
57+ // )
58+ // const { tSuccess } = usePWebNotification()
59+ // if (notificationData.data)
60+ // tSuccess({ title: notificationData.data.title, description: notificationData.data.body })
6161
62- const { title, body } = notificationData . data as { title : string ; body : string }
63- const notificationTitle = title
64- const notificationOptions = {
65- body,
66- icon : '/logo-dark.png' ,
67- }
62+ // const { title, body } = notificationData.data as { title: string; body: string }
63+ // const notificationTitle = title
64+ // const notificationOptions = {
65+ // body,
66+ // icon: '/logo-dark.png',
67+ // }
6868
69- navigator . serviceWorker . ready . then ( ( registration ) => {
70- registration
71- . showNotification ( notificationTitle , notificationOptions )
72- . then ( ( ) => {
73- // eslint-disable-next-line no-console
74- console . log ( '[firebase-messaging-sw.js] Notification shown' )
75- } )
76- . catch ( ( error ) => {
77- console . error (
78- '[firebase-messaging-sw.js] Error showing notification' ,
79- error ,
80- )
81- } )
82- } )
83- } )
69+ // navigator.serviceWorker.ready.then((registration) => {
70+ // registration
71+ // .showNotification(notificationTitle, notificationOptions)
72+ // .then(() => {
73+ // // eslint-disable-next-line no-console
74+ // console.log('[firebase-messaging-sw.js] Notification shown')
75+ // })
76+ // .catch((error) => {
77+ // console.error(
78+ // '[firebase-messaging-sw.js] Error showing notification',
79+ // error,
80+ // )
81+ // })
82+ // })
83+ // })
84+ // }
0 commit comments