import type { NextPage } from "next"; import { Layout } from "@/components/layout"; import Image from "next/image"; import { useState, useEffect, useLayoutEffect, useRef } from "react"; import Header, { notify, ToastType } from "@/components/header"; import { Footer } from "@/components/footer"; import Background from "@/components/Background"; import React from "react"; import { handleInputChange } from "@/lib/handleInputChange"; import { InputField } from "@/components/InputField"; import OutlineButton from "@/components/OutlineButton"; import { useToasts } from "@/components/ToastProvider"; import { useSession } from 'next-auth/react' const Home: NextPage = ({ officers }) => { const { toastDispatch } = useToasts(); const [input, setInput] = useState({ phone: '', }) const { data: session } = useSession() const submit = async () => { const operator = await fetch(process.env.NEXT_PUBLIC_API_URL + '/operator/update', { method: 'POST', headers: { 'Content-Type': 'application/json', 'Authorization': `Bearer ${session['token'].sub}` }, body: JSON.stringify({ phone: input.phone }) }) notify(toastDispatch, "", "Updated Phone: " + input.phone, ToastType.SUCCESS) } return (
{ session ?

Hey {session.user.name.split(' ')[0]}!

Can you give us your number real quick?

handleInputChange(e, input, setInput)} className="w-full" />
: null }
); }; export default Home;