Fetch data
export const getData = async () => {
const requestOptions = {
method: "GET",
headers: {
accept: "application/json",
"Content-Type": "application/json",
Authorization: "Bearer hjfdlsöfods_8i89673fds-fdsrfsd",
},
};
try {
const result = await fetch(
"https://api.radixapi.net/v1/route/endpoint",
requestOptions
).then((res) => res.json());
if (result.code === 200) {
return result.data;
} else return -1;
} catch (error) {
console.log("Error during data fetch: ", error);
return -1;
}
};Last updated