Complete Story 1-1 and fix TypeScript issues
Add TypeScript strict mode and typecheck tasks to monorepo infrastructure. Fix E2E test @payload-config alias and frontend TypeScript errors. - Add tsconfig.json to backend with strict mode and path aliases - Add typecheck task to Turborepo and all packages - Fix @payload-config alias for E2E tests and dev server - Add setToken method to AuthService for middleware use - Fix implicit any types in Footer.astro and Header.astro - Remove invalid typescript config from astro.config.mjs
This commit is contained in:
@@ -1,13 +1,27 @@
|
||||
import type { GlobalAfterChangeHook } from 'payload'
|
||||
|
||||
import { revalidateTag } from 'next/cache'
|
||||
import { auditLogger } from '@/utilities/auditLogger'
|
||||
|
||||
export const revalidateHeader: GlobalAfterChangeHook = ({ doc, req: { payload, context } }) => {
|
||||
export const revalidateHeader: GlobalAfterChangeHook = async ({ doc, req }) => {
|
||||
const { payload, context } = req
|
||||
if (!context.disableRevalidate) {
|
||||
payload.logger.info(`Revalidating header`)
|
||||
|
||||
revalidateTag('global_header')
|
||||
}
|
||||
|
||||
// 記錄 Header 變更
|
||||
if (req.user) {
|
||||
await auditLogger(req, {
|
||||
action: 'update',
|
||||
collection: 'global_header',
|
||||
userId: req.user.id,
|
||||
userName: req.user.name as string,
|
||||
userEmail: req.user.email as string,
|
||||
userRole: req.user.role as string,
|
||||
})
|
||||
}
|
||||
|
||||
return doc
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user