diff --git a/src/frontend/src/contexts/alertContext.tsx b/src/frontend/src/contexts/alertContext.tsx index 62ae2e396..781ecd2af 100644 --- a/src/frontend/src/contexts/alertContext.tsx +++ b/src/frontend/src/contexts/alertContext.tsx @@ -1,30 +1,9 @@ import { createContext, ReactNode, useState } from "react"; import { AlertItemType } from "../types/alerts"; +import { alertContextType } from "../types/typesContext"; import _ from "lodash"; -//types for alertContextType -type alertContextType = { - errorData: { title: string; list?: Array }; - setErrorData: (newState: { title: string; list?: Array }) => void; - errorOpen: boolean; - setErrorOpen: (newState: boolean) => void; - noticeData: { title: string; link?: string }; - setNoticeData: (newState: { title: string; link?: string }) => void; - noticeOpen: boolean; - setNoticeOpen: (newState: boolean) => void; - successData: { title: string }; - setSuccessData: (newState: { title: string }) => void; - successOpen: boolean; - setSuccessOpen: (newState: boolean) => void; - notificationCenter: boolean; - setNotificationCenter: (newState: boolean) => void; - notificationList: Array; - pushNotificationList: (Object: AlertItemType) => void; - clearNotificationList: () => void; - removeFromNotificationList: (index: string) => void; -}; - //initial values to alertContextType const initialValue: alertContextType = { errorData: { title: "", list: [] }, diff --git a/src/frontend/src/types/typesContext/index.ts b/src/frontend/src/types/typesContext/index.ts index 64b6e3e9d..984dda332 100644 --- a/src/frontend/src/types/typesContext/index.ts +++ b/src/frontend/src/types/typesContext/index.ts @@ -1,5 +1,6 @@ import { ReactFlowInstance } from "reactflow"; import { APIClassType } from "../api"; +import { AlertItemType } from "../alerts"; const types: { [char: string]: string } = {}; const template: { [char: string]: APIClassType } = {}; @@ -16,3 +17,24 @@ export type typesContextType = { data: typeof data; setData: (newState: {}) => void; }; + +export type alertContextType = { + errorData: { title: string; list?: Array }; + setErrorData: (newState: { title: string; list?: Array }) => void; + errorOpen: boolean; + setErrorOpen: (newState: boolean) => void; + noticeData: { title: string; link?: string }; + setNoticeData: (newState: { title: string; link?: string }) => void; + noticeOpen: boolean; + setNoticeOpen: (newState: boolean) => void; + successData: { title: string }; + setSuccessData: (newState: { title: string }) => void; + successOpen: boolean; + setSuccessOpen: (newState: boolean) => void; + notificationCenter: boolean; + setNotificationCenter: (newState: boolean) => void; + notificationList: Array; + pushNotificationList: (Object: AlertItemType) => void; + clearNotificationList: () => void; + removeFromNotificationList: (index: string) => void; +};