mirror of
https://github.com/kremalicious/umami.git
synced 2024-11-25 20:02:46 +01:00
execute onSave only if exists / update cache and show toast
This commit is contained in:
parent
8a4623eb7b
commit
27f5c8fceb
@ -1,12 +1,16 @@
|
||||
import { Button, Icon, Text, Modal, Icons, ModalTrigger } from 'react-basics';
|
||||
import { Button, Icon, Text, Modal, Icons, ModalTrigger, useToasts } from 'react-basics';
|
||||
import UserAddForm from './UserAddForm';
|
||||
import useMessages from 'components/hooks/useMessages';
|
||||
import { setValue } from 'store/cache';
|
||||
|
||||
export function UserAddButton({ onSave }) {
|
||||
const { formatMessage, labels } = useMessages();
|
||||
const { formatMessage, labels, messages } = useMessages();
|
||||
const { showToast } = useToasts();
|
||||
|
||||
const handleSave = () => {
|
||||
onSave();
|
||||
showToast({ message: formatMessage(messages.saved), variant: 'success' });
|
||||
setValue('users', Date.now());
|
||||
onSave?.();
|
||||
};
|
||||
|
||||
return (
|
||||
|
Loading…
Reference in New Issue
Block a user