Files
blitzkit/src/hooks/useAdExempt.ts
T

16 lines
393 B
TypeScript
Raw Normal View History

2024-06-15 13:16:12 -05:00
import { use } from 'react';
2024-06-14 13:57:54 -05:00
import { useApp } from '../stores/app';
export function useAdExempt() {
const patreon = useApp((state) => state.logins.patreon);
if (!patreon) return false;
2024-06-15 13:16:12 -05:00
const json = use(
fetch(`/api/patreon/membership/${patreon.token}`, {
cache: 'force-cache',
}).then((response) => response.json()),
);
return typeof json === 'boolean' && json;
2024-06-14 13:57:54 -05:00
}