feat: integrate dialog close context in vendor select field and CRUD dialog components feat: enhance vendor general info to format status using utility function feat: implement form dialog context for managing dialog close actions feat: add async select field dialog close context for better form handling fix: update form mutation hook to close dialog on successful submission feat: extend document print types to include expense and credit note feat: add settings update payload type to include logo and other fields feat: create employee attendance and work history pages with resource management feat: implement payment made and received detail pages with actions feat: add quick shortcuts component for easy navigation in the dashboard feat: create actions for payment made and received with print and delete options feat: implement dialog close context for better dialog management feat: add error parsing utility for improved error handling in API responses
13 lines
427 B
TypeScript
13 lines
427 B
TypeScript
"use client"
|
|
|
|
import { createContext, useContext } from "react"
|
|
|
|
// Closes the nearest dialog/sheet wrapper. `null` means the form is not
|
|
// inside a dialog that should auto-close (or a parent has explicitly
|
|
// shadowed the context, e.g. CrudDialog).
|
|
export const DialogCloseContext = createContext<(() => void) | null>(null)
|
|
|
|
export function useDialogClose(): (() => void) | null {
|
|
return useContext(DialogCloseContext)
|
|
}
|