mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-21 10:47:04 +02:00
feat: cache exempt
This commit is contained in:
1 parent
e6d2817524
commit
463371de18
1 file changed
+8
-1
@@ -1,7 +1,11 @@
|
|||||||
import { use } from 'react';
|
import { use } from 'react';
|
||||||
import { useApp } from '../stores/app';
|
import { useApp } from '../stores/app';
|
||||||
|
|
||||||
|
let cache: boolean | undefined = undefined;
|
||||||
|
|
||||||
export function useAdExempt() {
|
export function useAdExempt() {
|
||||||
|
if (cache !== undefined) return cache;
|
||||||
|
|
||||||
const patreon = useApp((state) => state.logins.patreon);
|
const patreon = useApp((state) => state.logins.patreon);
|
||||||
|
|
||||||
if (!patreon) return false;
|
if (!patreon) return false;
|
||||||
@@ -12,5 +16,8 @@ export function useAdExempt() {
|
|||||||
}).then((response) => response.json()),
|
}).then((response) => response.json()),
|
||||||
);
|
);
|
||||||
|
|
||||||
return typeof json === 'boolean' && json;
|
const exempt = typeof json === 'boolean' && json;
|
||||||
|
cache = exempt;
|
||||||
|
|
||||||
|
return exempt;
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user