18 lines
377 B
TypeScript
18 lines
377 B
TypeScript
import axios from "axios";
|
|
|
|
export async function getAPIDummy(url: any) {
|
|
const response = await axios.get(url).catch((error) => error.response);
|
|
if (response?.status > 300) {
|
|
return {
|
|
error: true,
|
|
message: response?.data?.error_description,
|
|
data: null,
|
|
};
|
|
}
|
|
return {
|
|
error: false,
|
|
message: "success",
|
|
data: response?.data,
|
|
};
|
|
}
|