mirror of
https://github.com/darksaid98/new-phone-who-dis.git
synced 2026-12-03 22:16:54 +00:00
* Improve messages error handling * Add types to getPlayerFromIdentifier function * Add phone validation regex to message group form * Add correct alert types to enum * Improve locale * Improve error message for unregistered numbers
19 lines
453 B
TypeScript
19 lines
453 B
TypeScript
import { useContext } from 'react';
|
|
import { SnackbarContext } from '../providers/SnackbarProvider';
|
|
|
|
export interface IAlert {
|
|
message: string;
|
|
type: AlertType;
|
|
}
|
|
|
|
export type AlertType = 'success' | 'error' | 'info' | 'warning';
|
|
|
|
interface ISnackBar {
|
|
addAlert: ({ message, type }: IAlert) => void;
|
|
alert: IAlert | null;
|
|
isOpen: boolean;
|
|
handleClose: () => void;
|
|
}
|
|
|
|
export const useSnackbar = (): ISnackBar => useContext(SnackbarContext);
|