()
| 8 | import CustomLink from "./custom-link" |
| 9 | |
| 10 | const UpdateForm = () => { |
| 11 | const { data: session, update } = useSession() |
| 12 | const [name, setName] = useState(`New ${session?.user?.name}`) |
| 13 | |
| 14 | if (!session?.user) return null |
| 15 | return ( |
| 16 | <> |
| 17 | <h2 className="text-xl font-bold">Updating the session client-side</h2> |
| 18 | <div className="flex w-full max-w-sm items-center space-x-2"> |
| 19 | <Input |
| 20 | type="text" |
| 21 | placeholder="New name" |
| 22 | value={name} |
| 23 | onChange={(e) => { |
| 24 | setName(e.target.value) |
| 25 | }} |
| 26 | /> |
| 27 | <Button onClick={() => update({ user: { name } })} type="submit"> |
| 28 | Update |
| 29 | </Button> |
| 30 | </div> |
| 31 | </> |
| 32 | ) |
| 33 | } |
| 34 | |
| 35 | export default function ClientExample() { |
| 36 | const { data: session, status } = useSession() |
nothing calls this directly
no outgoing calls
no test coverage detected