Refactor query message toast
This commit is contained in:
20
apps/frontend/app/lib/QueryMessages.tsx
Normal file
20
apps/frontend/app/lib/QueryMessages.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
import type { ReactNode } from 'react';
|
||||
|
||||
export enum QueryMessageType {
|
||||
Info = 'info',
|
||||
Success = 'success',
|
||||
Warning = 'warning',
|
||||
Error = 'error',
|
||||
}
|
||||
|
||||
export enum QueryMessageCode {
|
||||
SessionExpired = 'SESSION_EXPIRED',
|
||||
InitializationRequired = 'INITIALIZATION_REQUIRED',
|
||||
InitializationSuccessful = 'INITIALIZATION_SUCCESSFUL',
|
||||
}
|
||||
|
||||
export const CODE_TO_MESSAGE_MAP: Record<QueryMessageCode, ReactNode> = {
|
||||
[QueryMessageCode.SessionExpired]: 'Your session has expired. Please log in again.',
|
||||
[QueryMessageCode.InitializationRequired]: 'The application requires initialization. Please follow the setup instructions.',
|
||||
[QueryMessageCode.InitializationSuccessful]: 'Initialization successful. Please log in.',
|
||||
} as const;
|
||||
Reference in New Issue
Block a user