アカウント削除

1import { httpsCallable } from 'firebase/functions';
2import React from 'react';
3import { fns } from '../firebase/client';
4
5const DeleteAccount = () => {
6  const deleteAccount = () => {
7    const callabe = httpsCallable(fns, 'deleteUser');
8    callabe()
9      .then(() => {
10        alert('アカウントを削除しました');
11      })
12      .catch(() => {
13        alert('有効なユーザーでログインしてください');
14      });
15  };
16
17  return (
18    <div>
19      <button className="px-4 py-2 rounded-md border" onClick={deleteAccount}>
20        アカウントを削除
21      </button>
22    </div>
23  );
24};
25
26export default DeleteAccount;

使用ライブラリ

なし

参考サイト