Skip to content

Commit

Permalink
test: test
Browse files Browse the repository at this point in the history
  • Loading branch information
eun-hak committed Jun 7, 2024
1 parent 0623e4c commit 77d9146
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
14 changes: 7 additions & 7 deletions src/components/pwa/Test.tsx
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
import { useEffect } from 'react';
import {
registerServiceWorker,
requestNotificationPermission
// sendPushNotification
requestNotificationPermission,
sendPushNotification
} from './SetUp';

export const Test = () => {
// 푸시 알림 테스트
// const clickPushHandler = () => {
// // sendPushNotification('매직포스 알림', '알림 가나요?');
// };
const clickPushHandler = () => {
sendPushNotification('매직포스 알림', '알림 가나요?');
};
useEffect(() => {
registerServiceWorker();
requestNotificationPermission();
// 직접 푸시 알림 테스트
// sendPushNotification('테스트 알림', '테스트 알림입니다.');
sendPushNotification('테스트 알림', '테스트 알림입니다.');
}, []);

// return <button onClick={clickPushHandler}>알림 보내기</button>;
return <button onClick={clickPushHandler}>알림 보내기</button>;
};
10 changes: 5 additions & 5 deletions src/pages/sign/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import SignInButton from '@/components/shared/sign/SignInButton';
import SignUpButton from '@/components/shared/sign/SignUpButton';

import Link from 'next/link';
// import useSendPush from '@/components/pwa/UseSendPush';
import useSendPush from '@/components/pwa/UseSendPush';
import { getTokenHandler } from '@/components/pwa/Fcm';
import { useEffect, useState } from 'react';
import { useRouter } from 'next/navigation';
Expand All @@ -23,7 +23,7 @@ const SignHomePage = () => {
/* eslint-disable */
const [FcmToken, setFcmToken] = useState('');

// const sendPush = useSendPush();
const sendPush = useSendPush();
//
useEffect(() => {
const fetchToken = async () => {
Expand All @@ -40,7 +40,7 @@ const SignHomePage = () => {
fetchToken();
}, []);

// console.log(FcmToken);
console.log(FcmToken);
return (
<MainContainer>
<div className="flex flex-col justify-center items-center gap-[39px] h-[470px]">
Expand Down Expand Up @@ -75,7 +75,7 @@ const SignHomePage = () => {
</div>
{Test()}
<div>
{/* <button
<button
onClick={() => {
sendPush({
title: `알림테스트`,
Expand All @@ -85,7 +85,7 @@ const SignHomePage = () => {
});
}}>
fcm 테스트
</button> */}
</button>
</div>
</MainContainer>
);
Expand Down

0 comments on commit 77d9146

Please sign in to comment.