fix: template

This commit is contained in:
archer
2023-06-20 10:40:49 +08:00
parent a02a528737
commit 3166376173
6 changed files with 12 additions and 36 deletions

View File

@@ -31,7 +31,7 @@ const queryClient = new QueryClient({
function App({ Component, pageProps }: AppProps) {
const {
loadInitData,
initData: { googleVerKey }
initData: { googleVerKey, baiduTongji }
} = useGlobalStore();
useEffect(() => {
@@ -52,7 +52,7 @@ function App({ Component, pageProps }: AppProps) {
<Script src="/js/qrcode.min.js" strategy="afterInteractive"></Script>
<Script src="/js/pdf.js" strategy="afterInteractive"></Script>
<Script src="/js/html2pdf.bundle.min.js" strategy="afterInteractive"></Script>
<Script src="/js/baidutongji.js" strategy="afterInteractive"></Script>
{baiduTongji && <Script src="/js/baidutongji.js" strategy="afterInteractive"></Script>}
{googleVerKey && (
<>
<Script

View File

@@ -5,13 +5,15 @@ import { jsonRes } from '@/service/response';
export type InitDateResponse = {
beianText: string;
googleVerKey: string;
baiduTongji: boolean;
};
export default async function handler(req: NextApiRequest, res: NextApiResponse) {
jsonRes<InitDateResponse>(res, {
data: {
beianText: process.env.SAFE_BEIAN_TEXT || '',
googleVerKey: process.env.CLIENT_GOOGLE_VER_TOKEN || ''
googleVerKey: process.env.CLIENT_GOOGLE_VER_TOKEN || '',
baiduTongji: process.env.BAIDU_TONGJI === '1'
}
});
}

View File

@@ -19,7 +19,8 @@ export const useGlobalStore = create<State>()(
immer((set, get) => ({
initData: {
beianText: '',
googleVerKey: ''
googleVerKey: '',
baiduTongji: false
},
async loadInitData() {
try {