import { useEffect, useState } from "react"; import AppBar from "../../../components/AppBar"; import Layout from "../../../components/Layout"; import Link from "../../../components/Link"; import WithAuth from "../../../components/WithAuth"; import apiOdoo from "../../../helpers/apiOdoo"; import { useAuth } from "../../../helpers/auth"; export default function Address() { const [auth] = useAuth(); const [addresses, setAddresses] = useState(null); useEffect(() => { const getAddress = async () => { if (auth) { const dataAddress = await apiOdoo('GET', `/api/v1/user/${auth.id}/address`); setAddresses(dataAddress); } }; getAddress(); }, [auth]); return (
Tambah Alamat
{ addresses && addresses.map((address, index) => (

{ address.name }

{ address.mobile }

{ address.street } { address.street2 }

)) }
) }