Skip to content

Commit 8bd8f5e

Browse files
committed
trying to fix
1 parent 0118a11 commit 8bd8f5e

57 files changed

Lines changed: 552 additions & 1421 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
.vercel
2+
toki-fresh

backend/src/controllers/users.controller.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -380,4 +380,19 @@ export const getUserByIds = async (req: Request, res:Response) => {
380380
success: false,
381381
})
382382
}
383+
}
384+
385+
export const logoutUser = async (req: Request, res: Response, next:NextFunction) => {
386+
try {
387+
res.cookie("token", null, {
388+
expires: new Date(Date.now()),
389+
httpOnly: true,
390+
});
391+
res.status(201).json({
392+
success: true,
393+
message: "Log out successful!",
394+
});
395+
} catch (error: any) {
396+
return next(new ErrorHandler(error.message, 500));
397+
}
383398
}

backend/src/routes/user.route.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { getfollowings, getUserByIds, getUserProfile, getUserProfileFollowing, googleLogin, login, register, valid } from "../controllers/users.controller";
1+
import { getfollowings, getUserByIds, getUserProfile, getUserProfileFollowing, googleLogin, login, logoutUser, register, valid } from "../controllers/users.controller";
22
import express from "express";
33
import multer from "multer";
44
import middleware from "../middleware/middleware";
@@ -13,5 +13,6 @@ router.get('/valid',valid)
1313
router.get('/following',middleware,getfollowings)
1414
router.get('/profile/:id',middleware,getUserProfile)
1515
router.post('/profile/followings',upload.none(),middleware,getUserProfileFollowing)
16+
router.get("/logout", logoutUser)
1617

1718
export default router;

frontend/.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,3 +39,5 @@ yarn-error.log*
3939
# typescript
4040
*.tsbuildinfo
4141
next-env.d.ts
42+
43+
text

frontend/Types/types.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { string } from "zod/v4";
21

32
export interface Auth {
43
name?: string;
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
export const dynamic = 'force-dynamic'
12
import AuthForm from "@/components/AuthForm"
23

3-
const Signin = () => {
4+
const page = () => {
45
return (
56
<>
67
<AuthForm type="sign-in"/>
78
</>
89
)
910
}
1011

11-
export default Signin
12+
export default page
Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
export const dynamic = 'force-dynamic'
12
import AuthForm from "@/components/AuthForm"
23

3-
const Signup = () => {
4+
const page = () => {
45
return (
56
<>
67
<AuthForm type="sign-up"/>
78
</>
89
)
910
}
1011

11-
export default Signup
12+
export default page

frontend/app/(root)/create/page.tsx

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
export const dynamic = 'force-dynamic'
12
import UploadForm from '@/components/uploadForm/UploadForm'
23

34
const page = () => {
@@ -9,3 +10,4 @@ const page = () => {
910
}
1011

1112
export default page
13+

frontend/app/(root)/explore/page.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
1+
export const dynamic = 'force-dynamic'
12
import Explore from "@/components/card/Explore"
23
import { ExploreHeader } from "@/components/navigation/Header"
34

5+
46
const page = async () => {
57
return (
68
<>
@@ -11,3 +13,4 @@ const page = async () => {
1113
}
1214

1315
export default page
16+

frontend/app/(root)/layout.tsx

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
import MobileNav from "@/components/navigation/MobileNav"
2-
import Sidebar from "@/components/navigation/Sidebar"
3-
import { ApolloWrapper } from "@/context/ApolloClientProvider"
42

5-
const layout = ({children}:{children: React.ReactNode}) => {
3+
const Layout = ({children}:{children: React.ReactNode}) => {
64
return (
75
<main className='min-h-screen bg-background max-w-lg mx-auto relative'>
86
{children}
@@ -16,4 +14,4 @@ const layout = ({children}:{children: React.ReactNode}) => {
1614
)
1715
}
1816

19-
export default layout
17+
export default Layout

0 commit comments

Comments
 (0)