Skip to content

Commit

Permalink
made addtoast a coditional
Browse files Browse the repository at this point in the history
  • Loading branch information
elraphty committed Nov 8, 2024
1 parent 324fa13 commit ab4e52e
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/pages/superadmin/header/InviteModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { Modal } from '../../../components/common';
interface InviteProps {
open: boolean;
close: () => void;
addToast: (title: string, color: 'success' | 'error') => void;
addToast?: (title: string, color: 'success' | 'error') => void;
}

const WithdrawModalTitle = styled.h3`
Expand Down Expand Up @@ -39,11 +39,11 @@ const InviteModal = (props: InviteProps) => {
const status = await main.createConnectionCodes(inviteNumber);

if (status === 200) {
addToast('Users invite code created successfully', 'success');
if (addToast) addToast('Users invite code created successfully', 'success');
setInviteNumber(1);
close();
} else {
addToast('Could not create users invite code', 'error');
if (addToast) addToast('Could not create users invite code', 'error');
}
setLoading(false);
};
Expand Down
2 changes: 1 addition & 1 deletion src/pages/superadmin/header/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ interface HeaderProps {
setEndDate: (newDate: number) => void;
workspace: string;
setWorkspace: React.Dispatch<React.SetStateAction<string>>;
addToast: (title: string, color: 'success' | 'error') => void;
addToast?: (title: string, color: 'success' | 'error') => void;
}
export const Header = ({
startDate,
Expand Down

0 comments on commit ab4e52e

Please sign in to comment.