* Change to using arrow functions Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> * Add lint rule --------- Co-authored-by: v1b3m <vibenjamin6@gmail.com> Co-authored-by: Matheus <matheus_benini@hotmail.com> Co-authored-by: Charles Bochet <charles@twenty.com>
18 lines
429 B
TypeScript
18 lines
429 B
TypeScript
import { useSetRecoilState } from 'recoil';
|
|
import { v4 as uuidv4 } from 'uuid';
|
|
|
|
import { DialogOptions, dialogSetQueueState } from '../states/dialogState';
|
|
|
|
export const useDialog = () => {
|
|
const setDialogQueue = useSetRecoilState(dialogSetQueueState);
|
|
|
|
const enqueueDialog = (options?: Omit<DialogOptions, 'id'>) => {
|
|
setDialogQueue({
|
|
id: uuidv4(),
|
|
...options,
|
|
});
|
|
};
|
|
|
|
return { enqueueDialog };
|
|
};
|