mirror of
https://github.com/fsolla/teqo.git
synced 2026-11-18 05:53:05 +00:00
Integrate a real-time signature counter component into petition pages. This includes: - A new `SignatureCounter` component that displays and animates the signature count. - Server action `getSignatureCount` to fetch current signatures from Payload. - Updates to `submitPetitionSignature` to return the signature number for immediate display. - Event listeners for real-time updates when new signatures are submitted. - Integration of the counter into both the hero section and card views of the petition page. - Improved dialog for displaying signature success and number.
15 lines
370 B
TypeScript
15 lines
370 B
TypeScript
'use server'
|
|
|
|
import config from '@payload-config'
|
|
import { getPayload } from 'payload'
|
|
|
|
export const getSignatureCount = async (petitionId: string): Promise<number> => {
|
|
const payload = await getPayload({ config })
|
|
|
|
const { totalDocs } = await payload.count({
|
|
collection: 'signature',
|
|
where: { petition: { equals: petitionId } },
|
|
})
|
|
|
|
return totalDocs
|
|
}
|