| 123456789101112131415161718192021222324252627282930313233343536373839404142 |
- import apiEndpoints from '../apiEndpoints';
-
- export const createUser = async (
- fullName,
- username,
- email,
- password,
- address,
- address2,
- city,
- country,
- postcode
- ) => {
- const response = await fetch(
- `http://localhost:3000${apiEndpoints.account.createUser}`,
- {
- method: 'POST',
- body: JSON.stringify({
- fullName,
- username,
- email,
- password,
- address,
- address2,
- city,
- country,
- postcode,
- }),
- headers: {
- 'Content-Type': 'application/json',
- },
- }
- );
-
- const data = await response.json();
-
- if (!response.ok) {
- throw new Error(data.message || 'Something went wrong!');
- }
-
- return data;
- };
|