const mobileRegister = async (fullname, email, password) => {
try {
const response = await fetch('https://api.weir.ai/auth/m/register', {
method: 'POST',
headers: {
'Content-Type': 'application/json'
},
body: JSON.stringify({ fullname, email, password })
});
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
const data = await response.json();
return data.data;
} catch (error) {
console.error('Mobile registration error:', error);
throw error;
}
};
// Usage
const registrationData = await mobileRegister(
'Jane Smith',
'[email protected]',
'SecurePassword123!'
);
console.log('OTP Session:', registrationData.otpSession);