26 lines
689 B
TypeScript
26 lines
689 B
TypeScript
/* Copyright (C) 2024 Manuel Bustillo*/
|
|
|
|
'use client'
|
|
|
|
import { GlobalSummary as Summary } from '@/app/lib/definitions';
|
|
import { getSlug } from '@/app/lib/utils';
|
|
import GlobalSummary from '@/app/ui/dashboard/global-summary';
|
|
import { useEffect, useState } from 'react';
|
|
|
|
export default function Page() {
|
|
const [globalSummary, setGlobalSummary] = useState<Summary | undefined>(undefined);
|
|
|
|
function refreshSummary() {
|
|
fetch(`/api/${getSlug()}/summary`)
|
|
.then((response) => response.json())
|
|
.then((data) => {
|
|
setGlobalSummary(data);
|
|
})
|
|
}
|
|
|
|
useEffect(refreshSummary, []);
|
|
|
|
return (
|
|
globalSummary && <GlobalSummary summary={globalSummary} />
|
|
);
|
|
} |