Refactor some functions. Try to fetch functions from github api just once when vrct started.(It used to every time plugin tab has opened so easy to reach to the api limit)
21 lines
589 B
JavaScript
21 lines
589 B
JavaScript
import { fetch as tauriFetch, ResponseType } from "@tauri-apps/api/http";
|
|
|
|
export const useFetch = () => {
|
|
const asyncTauriFetchGithub = async (url) => {
|
|
console.log("tauriFetch");
|
|
|
|
const release_response = await tauriFetch(url, {
|
|
method: "GET",
|
|
responseType: ResponseType.Json,
|
|
headers: {
|
|
"Accept": "application/vnd.github+json",
|
|
"User-Agent": "VRCTPluginApp"
|
|
}
|
|
});
|
|
return release_response;
|
|
};
|
|
|
|
return {
|
|
asyncTauriFetchGithub,
|
|
};
|
|
}; |