mirror of
https://github.com/emsesp/EMS-ESP32.git
synced 2025-12-06 15:59:52 +03:00
adjust cache
This commit is contained in:
@@ -9,7 +9,7 @@ export const ACCESS_TOKEN = 'access_token';
|
|||||||
export const alovaInstance = createAlova({
|
export const alovaInstance = createAlova({
|
||||||
statesHook: ReactHook,
|
statesHook: ReactHook,
|
||||||
// timeout: 3000, // 3 seconds before throwing a timeout error, default is 0 = none
|
// timeout: 3000, // 3 seconds before throwing a timeout error, default is 0 = none
|
||||||
cacheFor: null, // disable cache
|
// cacheFor: null, // disable cache
|
||||||
// cacheFor: {
|
// cacheFor: {
|
||||||
// GET: {
|
// GET: {
|
||||||
// mode: 'memory',
|
// mode: 'memory',
|
||||||
|
|||||||
@@ -14,8 +14,10 @@ export const updateLogSettings = (data: LogSettings) =>
|
|||||||
export const fetchLogES = () => alovaInstance.Get('/es/log');
|
export const fetchLogES = () => alovaInstance.Get('/es/log');
|
||||||
|
|
||||||
// Get versions from GitHub
|
// Get versions from GitHub
|
||||||
|
// cache for 10 minutes to stop getting the IP blocked by GitHub
|
||||||
export const getStableVersion = () =>
|
export const getStableVersion = () =>
|
||||||
alovaInstanceGH.Get('latest', {
|
alovaInstanceGH.Get('latest', {
|
||||||
|
cacheFor: 60 * 10 * 1000,
|
||||||
transform(response: { data: { name: string; published_at: string } }) {
|
transform(response: { data: { name: string; published_at: string } }) {
|
||||||
return {
|
return {
|
||||||
name: response.data.name.substring(1),
|
name: response.data.name.substring(1),
|
||||||
@@ -25,6 +27,7 @@ export const getStableVersion = () =>
|
|||||||
});
|
});
|
||||||
export const getDevVersion = () =>
|
export const getDevVersion = () =>
|
||||||
alovaInstanceGH.Get('tags/latest', {
|
alovaInstanceGH.Get('tags/latest', {
|
||||||
|
cacheFor: 60 * 10 * 1000,
|
||||||
transform(response: { data: { name: string; published_at: string } }) {
|
transform(response: { data: { name: string; published_at: string } }) {
|
||||||
return {
|
return {
|
||||||
name: response.data.name.split(/\s+/).splice(-1)[0].substring(1),
|
name: response.data.name.split(/\s+/).splice(-1)[0].substring(1),
|
||||||
|
|||||||
Reference in New Issue
Block a user