aboutsummaryrefslogtreecommitdiffstats
path: root/src/views/NotificationTargets/EditNotificationTarget.jsx
blob: ba1a38a7642a36a3a281728c6d17b5480c31eda6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
import { useEffect, useState } from 'react'
import { useParams } from 'react-router-dom'

const EditNotificationTarget = () => {
  const { id } = useParams()
  const [notificationTarget, setNotificationTarget] = useState(null)
  const [loading, setLoading] = useState(true)
  const [error, setError] = useState(null)

  useEffect(() => {
    // const fetchNotificationTarget = async () => {
    //   try {
    //     const response = await fetch(`/api/notification-targets/${id}`)
    //     const data = await response.json()
    //     setNotificationTarget(data)
    //   } catch (error) {
    //     setError(error)
    //   } finally {
    //     setLoading(false)
    //   }
    // }
    // fetchNotificationTarget()
  }, [id])

  if (loading) {
    return <div>Loading...</div>
  }

  if (error) {
    return <div>Error: {error.message}</div>
  }

  return (
    <div>
      <h1>Edit Notification Target</h1>
      <form>
        <label>
          Name:
          <input type='text' value={notificationTarget.name} />
        </label>
        <label>
          Email:
          <input type='email' value={notificationTarget.email} />
        </label>
        <button type='submit'>Save</button>
      </form>
    </div>
  )
}

export default EditNotificationTarget