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

chore: addressed comments

This commit is contained in:
2023-08-08 15:01:32 +05:00
parent 8cdf605006
commit 1531e9cd9c
7 changed files with 36 additions and 36 deletions

View File

@@ -26,18 +26,20 @@ const Profile = () => {
const [isPasswordModalOpen, setIsPasswordModalOpen] = useState(false)
useEffect(() => {
setIsLoading(true)
axios
.get(`/SASjsApi/user/${appContext.userId}`)
.then((res: any) => {
setUser(res.data)
})
.catch((err) => {
console.log(err)
})
.finally(() => {
setIsLoading(false)
})
if (appContext.userId) {
setIsLoading(true)
axios
.get(`/SASjsApi/user/${appContext.userId}`)
.then((res: any) => {
setUser(res.data)
})
.catch((err) => {
console.log(err)
})
.finally(() => {
setIsLoading(false)
})
}
}, [appContext.userId])
const handleChange = (event: any) => {

View File

@@ -24,39 +24,32 @@ export enum RunTimeType {
interface AppContextProps {
checkingSession: boolean
loggedIn: boolean
setLoggedIn: Dispatch<SetStateAction<boolean>> | null
setLoggedIn?: Dispatch<SetStateAction<boolean>>
needsToUpdatePassword: boolean
setNeedsToUpdatePassword: Dispatch<SetStateAction<boolean>> | null
userId: string
setUserId: Dispatch<SetStateAction<string>> | null
setNeedsToUpdatePassword?: Dispatch<SetStateAction<boolean>>
userId?: string
setUserId?: Dispatch<SetStateAction<string | undefined>>
username: string
setUsername: Dispatch<SetStateAction<string>> | null
setUsername?: Dispatch<SetStateAction<string>>
displayName: string
setDisplayName: Dispatch<SetStateAction<string>> | null
setDisplayName?: Dispatch<SetStateAction<string>>
isAdmin: boolean
setIsAdmin: Dispatch<SetStateAction<boolean>> | null
setIsAdmin?: Dispatch<SetStateAction<boolean>>
mode: ModeType
runTimes: RunTimeType[]
logout: (() => void) | null
logout?: () => void
}
export const AppContext = createContext<AppContextProps>({
checkingSession: false,
loggedIn: false,
setLoggedIn: null,
needsToUpdatePassword: false,
setNeedsToUpdatePassword: null,
userId: '',
setUserId: null,
username: '',
setUsername: null,
displayName: '',
setDisplayName: null,
isAdmin: false,
setIsAdmin: null,
mode: ModeType.Server,
runTimes: [],
logout: null
runTimes: []
})
const AppContextProvider = (props: { children: ReactNode }) => {
@@ -64,7 +57,7 @@ const AppContextProvider = (props: { children: ReactNode }) => {
const [checkingSession, setCheckingSession] = useState(false)
const [loggedIn, setLoggedIn] = useState(false)
const [needsToUpdatePassword, setNeedsToUpdatePassword] = useState(false)
const [userId, setUserId] = useState('')
const [userId, setUserId] = useState<string>()
const [username, setUsername] = useState('')
const [displayName, setDisplayName] = useState('')
const [isAdmin, setIsAdmin] = useState(false)

View File

@@ -1,12 +1,12 @@
export interface UserResponse {
uid: number
uid: string
username: string
displayName: string
isAdmin: boolean
}
export interface GroupResponse {
uid: number
uid: string
name: string
description: string
}
@@ -17,7 +17,7 @@ export interface GroupDetailsResponse extends GroupResponse {
}
export interface PermissionResponse {
uid: number
uid: string
path: string
type: string
setting: string
@@ -30,7 +30,7 @@ export interface RegisterPermissionPayload {
type: string
setting: string
principalType: string
principalId: number
principalId: string
}
export interface TreeNode {