1
0
mirror of https://github.com/sasjs/server.git synced 2026-01-06 06:10:04 +00:00

fix: code/execute controller logic to handle different runtimes

This commit is contained in:
2022-06-17 20:01:50 +05:00
parent ab222cbaab
commit 23b6692f02
9 changed files with 114 additions and 64 deletions

View File

@@ -14,6 +14,11 @@ export enum ModeType {
Desktop = 'desktop'
}
export enum RunTimeType {
SAS = 'sas',
JS = 'js'
}
interface AppContextProps {
checkingSession: boolean
loggedIn: boolean
@@ -25,6 +30,7 @@ interface AppContextProps {
displayName: string
setDisplayName: Dispatch<SetStateAction<string>> | null
mode: ModeType
runTimes: RunTimeType[]
logout: (() => void) | null
}
@@ -39,6 +45,7 @@ export const AppContext = createContext<AppContextProps>({
displayName: '',
setDisplayName: null,
mode: ModeType.Server,
runTimes: [],
logout: null
})
@@ -50,6 +57,7 @@ const AppContextProvider = (props: { children: ReactNode }) => {
const [username, setUsername] = useState('')
const [displayName, setDisplayName] = useState('')
const [mode, setMode] = useState(ModeType.Server)
const [runTimes, setRunTimes] = useState<RunTimeType[]>([])
useEffect(() => {
setCheckingSession(true)
@@ -74,6 +82,7 @@ const AppContextProvider = (props: { children: ReactNode }) => {
.then((res) => res.data)
.then((data: any) => {
setMode(data.mode)
setRunTimes(data.runTimes)
})
.catch(() => {})
}, [])
@@ -99,6 +108,7 @@ const AppContextProvider = (props: { children: ReactNode }) => {
displayName,
setDisplayName,
mode,
runTimes,
logout
}}
>