Simplified console.logs on APIs

This commit is contained in:
keannu125 2023-03-10 21:34:50 +08:00
parent c3c5fafc73
commit 2f0238e147

View file

@ -50,11 +50,11 @@ export function UpdateProduct(product: UpdateProductParams) {
} }
) )
.then((response) => { .then((response) => {
console.log("Product update successful", response.data); console.log("Product update successful");
return response.data; return response.data;
}) })
.catch((error) => { .catch((error) => {
console.log("Error updating product", error.response); console.log("Error updating product");
return error; return error;
}); });
} }
@ -97,7 +97,7 @@ export function AddProduct(note: AddProductParams) {
return response.data; return response.data;
}) })
.catch((error) => { .catch((error) => {
console.log("Error adding product", error.response); console.log("Error adding product");
return error; return error;
}); });
} }
@ -114,7 +114,7 @@ export function DeleteProduct(id: number) {
} }
) )
.catch((error) => { .catch((error) => {
console.log("Error deleting product", error.response); console.log("Error deleting product");
return error; return error;
}); });
} }
@ -132,7 +132,7 @@ export function UserRegister(register: RegistrationParams) {
return true; return true;
}) })
.catch((error) => { .catch((error) => {
console.log("Registration failed: " + error.response); console.log("Registration failed");
return false; return false;
}); });
} }
@ -152,7 +152,7 @@ export function UserLogin(user: LoginParams) {
return true; return true;
}) })
.catch((error) => { .catch((error) => {
console.log("Login Failed: " + error.response); console.log("Login Failed");
return false; return false;
}); });
} }
@ -170,7 +170,7 @@ export function UserInfo() {
return response.data; return response.data;
}) })
.catch((error) => { .catch((error) => {
console.log("Error retrieving user data", error.response); console.log("Error retrieving user data");
return false; return false;
}); });
} }
@ -184,11 +184,11 @@ export function QueryUser(id: number) {
}, },
}) })
.then((response) => { .then((response) => {
console.log("Querying one user...", response.data); console.log("Success querying one user");
return response.data; return response.data;
}) })
.catch((error) => { .catch((error) => {
console.log("Error retrieving single user data", error.response); console.log("Error querying one user");
return false; return false;
}); });
} }
@ -204,7 +204,7 @@ export function UserActivate(activation: ActivationParams) {
return true; return true;
}) })
.catch((error) => { .catch((error) => {
console.log("Activation failed: " + error.response); console.log("Activation failed");
return false; return false;
}); });
} }