Skip to content

Commit c979699

Browse files
committed
fix: #142 fix session status 2
1 parent 8d26939 commit c979699

File tree

12 files changed

+161
-160
lines changed

12 files changed

+161
-160
lines changed

docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,5 +22,3 @@ networks:
2222
volumes:
2323
frontend_vol:
2424
driver: local
25-
26-

package-lock.json

Lines changed: 75 additions & 41 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,5 @@
4040
"prettier-plugin-tailwindcss": "^0.6.6",
4141
"tailwindcss": "^3.4.1",
4242
"typescript": "^5"
43-
},
44-
"overrides": {
45-
"ajv": "^8.17.1"
4643
}
4744
}

src/app/api/logout/route.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,9 @@ export async function GET(req: NextRequest) {
1010
const baseUrl = req.nextUrl.origin;
1111

1212
const headers: HeadersInit = {
13-
'Set-Cookie': [
14-
`${ACCESS_TOKEN_COOKIE}=; Path=/; Max-Age=0;`,
15-
`${REFRESH_TOKEN_COOKIE}=; Path=/; Max-Age=0;`
16-
].join(', ')
13+
'Set-Cookie': [`${ACCESS_TOKEN_COOKIE}=; Path=/; Max-Age=0;`, `${REFRESH_TOKEN_COOKIE}=; Path=/; Max-Age=0;`].join(
14+
', ',
15+
),
1716
};
1817

1918
await AuthService.logout();

src/app/layout.tsx

Lines changed: 22 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -19,37 +19,38 @@ const poppins = Poppins({
1919
subsets: ['latin'],
2020
display: 'swap',
2121
variable: '--font-poppins',
22-
weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900'],
22+
weight: ['100', '200', '300', '400', '500', '600', '700', '800', '900']
2323
});
2424

2525
export const metadata: Metadata = {
2626
title: METADATA.TITLE,
2727
description: METADATA.DESCRIPTION,
2828
keywords: METADATA.KEYWORDS,
29-
assets: METADATA.ASSETS,
29+
assets: METADATA.ASSETS
3030
};
3131

3232
export default function RootLayout({ children }: ComponentParentProps) {
3333
return (
3434
<html lang="pl" data-color-mode="single" data-theme="light-default">
35-
<ToastProvider>
36-
<body>
37-
<ThemeInitializer>
38-
<SessionProvider signUri="/auth">
39-
<SidebarProvider>
40-
<div id="container" className="h-auto min-h-fullContent w-full overflow-x-hidden">
41-
<Header />
42-
<Sidebar />
43-
<Main>{children}</Main>
44-
<Footer />
45-
<div id="modal"></div>
46-
</div>
47-
<ToastContainer />
48-
</SidebarProvider>
49-
</SessionProvider>
50-
</ThemeInitializer>
51-
</body>
52-
</ToastProvider>
35+
<ToastProvider>
36+
<body>
37+
<SessionProvider signUri="/auth">
38+
<ThemeInitializer>
39+
<SidebarProvider>
40+
<div id="container" className="h-auto min-h-fullContent w-full overflow-x-hidden">
41+
<Header />
42+
<Sidebar />
43+
<Main>{children}</Main>
44+
<Footer />
45+
<div id="modal"></div>
46+
</div>
47+
<ToastContainer />
48+
</SidebarProvider>
49+
</ThemeInitializer>
50+
</SessionProvider>
51+
</body>
52+
</ToastProvider>
5353
</html>
54-
);
54+
)
55+
;
5556
}

src/components/layout/navbar/right/NotificationDropDownMenu.tsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ interface NotificationDropDownMenuProps {
66

77
export default function NotificationDropDownMenu({ menuClassName }: NotificationDropDownMenuProps) {
88
return (
9-
<div className={`${menuClassName} w-60 bg-bg px-2 pb-2 pt-1 text-base font-normal text-secondary shadow-md`}>
10-
</div>
9+
<div className={`${menuClassName} w-60 bg-bg px-2 pb-2 pt-1 text-base font-normal text-secondary shadow-md`}></div>
1110
);
1211
}
Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,17 @@
11
'use client';
22
import { useSessionContext } from '@/contexts/SessionContext';
3-
import React, { useEffect, useState } from 'react';
3+
import React from 'react';
44
import { TEXT } from '@/utils/constant';
55
import { useRouter } from 'next/navigation';
66
import UserActionBtns from '@/components/layout/navbar/right/UserActionBtns';
77

88
export default function UserActionBlock() {
9-
const { session, sessionStatus } = useSessionContext();
10-
const [stateStatus, setStateStatus] = useState(sessionStatus);
9+
const sessionContext = useSessionContext();
1110
const router = useRouter();
1211

13-
useEffect(() => {
14-
setStateStatus(sessionStatus);
15-
}, [sessionStatus]);
16-
1712
return (
1813
<>
19-
{stateStatus === 'UNAUTHENTICATED' && (
14+
{sessionContext.sessionStatus === 'UNAUTHENTICATED' && (
2015
<div className="pr-2">
2116
<button
2217
className="flex h-[2.5rem] cursor-pointer items-center rounded-md bg-primary px-4 py-2 text-sm font-semibold text-textOnPrimary hover:bg-primaryHover"
@@ -27,7 +22,7 @@ export default function UserActionBlock() {
2722
</div>
2823
)}
2924

30-
{stateStatus === 'AUTHENTICATED' && <UserActionBtns />}
25+
{sessionContext.sessionStatus === 'AUTHENTICATED' && <UserActionBtns />}
3126
</>
3227
);
33-
}
28+
}

src/components/materials/add_modal/AddMaterialModal.tsx

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -163,16 +163,14 @@ export default function AddMaterialModal({ isOpen, onClose }: { isOpen: boolean;
163163
return;
164164
}
165165

166-
await MaterialService.publishMaterial(
167-
{
168-
title: data.details!.title,
169-
description: data.details!.description,
170-
link: data.details!.link,
171-
typeId: data.sectionId!,
172-
categoryId: data.categoryId!,
173-
tagsIds: data.details!.tagsIds,
174-
}
175-
);
166+
await MaterialService.publishMaterial({
167+
title: data.details!.title,
168+
description: data.details!.description,
169+
link: data.details!.link,
170+
typeId: data.sectionId!,
171+
categoryId: data.categoryId!,
172+
tagsIds: data.details!.tagsIds,
173+
});
176174

177175
addToast(`Dodano materiał`, 'success', 5000);
178176
handleClose();

0 commit comments

Comments
 (0)