21 lines
395 B
TypeScript
21 lines
395 B
TypeScript
import { CommentReply } from "timi-web";
|
|
|
|
/**
|
|
* emits
|
|
*/
|
|
export interface Emits {
|
|
(event: "cancel"): Promise<void>;
|
|
(event: "submit", reply: CommentReply): Promise<void>;
|
|
}
|
|
|
|
export const useHandler = (emit: Emits) => {
|
|
|
|
const onCancel = async () => await emit("cancel");
|
|
const onSubmit = async (reply: CommentReply) => await emit("submit", reply);
|
|
|
|
return {
|
|
onCancel,
|
|
onSubmit
|
|
};
|
|
};
|