const response = await fetch('https://dev.api.baanx.com/v1/auth/register/mailing-address', {
method: 'POST',
headers: {
'x-client-key': 'your-client-key',
'Content-Type': 'application/json'
},
body: JSON.stringify({
onboardingId: sessionStorage.getItem('onboardingId'),
addressLine1: 'PO Box 123',
city: 'New York',
zip: '10001',
usState: 'NY'
})
});
const { accessToken, user } = await response.json();
// Registration complete!
localStorage.setItem('access_token', accessToken);
console.log('Registration complete!', user);
// Redirect to dashboard
window.location.href = '/dashboard';