Skip to content
Snippets Groups Projects
Commit d1a1997f authored by Rafael László's avatar Rafael László :speech_balloon:
Browse files

Merge branch 'fix-auth-branch' into 'dev'

Fix auth branch

See merge request !18
parents c304518c 55fe5309
No related branches found
No related tags found
2 merge requests!19fix type imports,!18Fix auth branch
......@@ -119,7 +119,9 @@ const Header: React.FC<HeaderProps> = ({ customToolbar, menuItems = MENU_ITEMS }
}}
TabIndicatorProps={{ className: classes.indicator }}
>
{menuItems.map((item) => (
{menuItems.map(
(item) =>
(isNil(profile) || !profile.isLoggedIn || profile.profile) && (
<Tab
key={item.id}
className={classes.tab}
......@@ -128,8 +130,9 @@ const Header: React.FC<HeaderProps> = ({ customToolbar, menuItems = MENU_ITEMS }
history.push(item.redirectTo);
}}
/>
))}
{!isNil(profile) && (
),
)}
{!isNil(profile) && profile.profile && (
<>
{USER_MENU_ITEMS.map((item) => (
<Tab
......@@ -161,7 +164,9 @@ const Header: React.FC<HeaderProps> = ({ customToolbar, menuItems = MENU_ITEMS }
</Tabs>
</Grid>
{!isNil(profile) && profile.profile ? (
{!isNil(profile) && profile.isLoggedIn ? (
<>
{profile.profile && (
<>
<IconButton size="medium">
<Badge color="error">
......@@ -176,6 +181,9 @@ const Header: React.FC<HeaderProps> = ({ customToolbar, menuItems = MENU_ITEMS }
<Typography variant="h6" align="center" className={classes.texts}>
{profile.profile && profile.profile.name}
</Typography>
</>
)}
<a href="/api/v1/logout">
<Box color="secondary.main">
<IconButton color="inherit" size="medium">
......
......@@ -23,7 +23,7 @@ const ProfileForm: React.FC = () => {
client.invalidateQueries('me');
setRedirect(true);
}
}, [data, isError]);
}, [data, isError, client]);
return (
<Container
style={{
......
......@@ -11,19 +11,6 @@ export interface UserContextType {
setProfile: (profile: ProfileWithStatus | undefined) => void;
}
/* // Context
// eslint-disable-next-line @typescript-eslint/no-unused-vars
const initialState: IProfile = {
externalId: 'abcd',
studentCardNumber: '1234',
roomNumber: 104,
role: Role.Admin,
email: 'alma@gmail.com',
name: 'Nagy Gizike',
warnings: [],
notices: [{ _id: '123', text: 'Asd', isSeen: false }],
}; */
export const UserContext = createContext({} as UserContextType);
const { Provider } = UserContext;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment