<template>
<section class="shadowbox">
<h2>Register</h2>
<account :error="''" @submit="create" />
</section>
</template>

<script setup>
import { ref } from "vue"
import Account from "./account.vue"

function create(user) {
  console.log(user)
  fetch(`/api/user`,
	    {method: 'POST',
	        body: JSON.stringify(user),
    		headers: {
        	"Accept": "application/json",
    		},
        }).then(resp => {
            console.log(resp)
            if (resp.ok) { return resp.json() } else { return resp.text() }
        }).then(u => console.log(u))
}
</script>

<style scoped>
section {
	max-width: 400px;
	margin: auto;
}
</style>
