Modified the doRegister function within register.service.ts to provide better error handling. Responses now return an object format, and an error catch block has been added. Additionally, minor changes were made to the workspace.xml.
22 lines
384 B
TypeScript
22 lines
384 B
TypeScript
'use client'
|
|
|
|
import axios from "axios";
|
|
|
|
|
|
async function doRegister(data: object) {
|
|
return axios.post('http://localhost:3333/auth/register', data)
|
|
.then(function (response) {
|
|
console.log(response);
|
|
return {
|
|
status: response.status,
|
|
data: response.data
|
|
}
|
|
})
|
|
.catch(function (error) {
|
|
console.warn(error);
|
|
return {
|
|
}
|
|
});
|
|
}
|
|
|
|
export default doRegister; |