const register = async (userData) => {
try {
const response = await fetch('https://api.weir.ai/auth/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify(userData)
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data.data;
} catch (error) {
console.error('Registration error:', error);
throw error;
}
};
// Usage
const registrationData = await register({
fullname: "John Doe",
email: "[email protected]",
password: "SecurePassword123!",
organization: {
name: "Acme Corporation",
type: "Platform",
description: "A business platform for NIL management"
}
});
console.log('OTP Session:', registrationData.otpSession);