Skip to content

Commit 7ac6fc7

Browse files
committed
chore: lint
1 parent 7c12731 commit 7ac6fc7

File tree

10 files changed

+26
-25
lines changed

10 files changed

+26
-25
lines changed

src/app/(ui)/(protected)/layout.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export default function ProtectedLayout({ children }: { children: React.ReactNod
2727
if (userData) {
2828
setUser(userData)
2929
}
30-
}, [userData])
30+
}, [userData,setUser])
3131

3232
if (isLoadingProfile) {
3333
return (

src/app/(ui)/(public)/login/components/login-form.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { HTMLAttributes, useState } from 'react'
1+
import { HTMLAttributes } from 'react'
22
import { useForm } from 'react-hook-form'
33
import { zodResolver } from '@hookform/resolvers/zod'
44
import { cn } from '@/lib/utils'

src/app/api/_services/token/token.service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ const generateToken = (payload: string | object | Buffer, expiresIn: number = 86
2121
const verifyToken = (token: string): JwtPayload | string | boolean => {
2222
try {
2323
return jwt.verify(token, secretKey);
24-
} catch (error) {
24+
} catch {
2525
return false
2626
}
2727
};

src/app/api/_services/user/user-service.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import prisma from "@/lib/prisma";
22
import bcrypt from "bcryptjs";
3-
import { NextRequest, NextResponse } from "next/server";
3+
import { NextRequest } from "next/server";
44

55
const username = "admin";
66
const password = "admin";

src/app/api/user/change-password/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { PasswordChangeSchema } from "@/schemas/user/auth.schema";
33
import bcrypt from "bcryptjs";
44
import { NextRequest, NextResponse } from "next/server";
55
import { z } from "zod";
6-
import { generateToken } from "../../_services/token/token.service";
76
import { getUserFromHeader } from "../../_services/user/user-service";
87

98
export async function POST(request: NextRequest) {

src/app/api/user/profile/route.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import prisma from "@/lib/prisma";
21
import { NextRequest, NextResponse } from "next/server";
32
import { getUserFromHeader } from "../../_services/user/user-service";
43

src/components/change-password.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react'
2-
import { Dialog, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, DialogTrigger } from './ui/dialog'
2+
import { Dialog, DialogContent, DialogDescription, DialogHeader, DialogTitle } from './ui/dialog'
33
import { Button } from './ui/button'
44
import { cn } from '@/lib/utils'
55
import { Form, FormControl, FormField, FormItem, FormLabel, FormMessage } from './ui/form'

src/components/profile-dropdown.tsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { Avatar, AvatarFallback, AvatarImage } from '@/components/ui/avatar'
1+
import { Avatar, AvatarFallback } from '@/components/ui/avatar'
22
import { Button } from '@/components/ui/button'
33
import {
44
DropdownMenu,
@@ -16,12 +16,10 @@ import { IconPassword } from '@tabler/icons-react'
1616

1717
type Props = {
1818
openPasswordDialog: () => void
19-
closePasswordDialog: () => void
2019
}
2120

2221
export function ProfileDropdown({
2322
openPasswordDialog,
24-
closePasswordDialog
2523
}: Props) {
2624
const logOut = useLogout()
2725
const { user } = useAuthStore()

src/hooks/user/user.hooks.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ export const useChangePassword = () => {
5353
onError: (err: Error) => {
5454
handleServerError(err);
5555
},
56-
onSuccess: async (data) => {
56+
onSuccess: async () => {
5757
toast("Password changed!");
5858
await queryClient.invalidateQueries({
5959
queryKey: ["profile"],

src/lib/parse-error.ts

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,32 @@
1+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
12
export const parseError = (error: any): string => {
23
try {
34
if (error.response?.data) {
4-
const errorData = error.response.data
5+
const errorData = error.response.data;
56
if (errorData.error?.details?.errors) {
6-
const errors = errorData.error.details.errors
7+
const errors = errorData.error.details.errors;
78
if (Array.isArray(errors)) {
89
const messages = errors.map((single) => {
910
if (single.message) {
10-
return `${single?.message}`
11+
return `${single?.message}`;
1112
}
12-
return `${single.join(' ')}`
13-
})
14-
return messages.join(' ')
13+
return `${single.join(" ")}`;
14+
});
15+
return messages.join(" ");
1516
}
1617
const messages = Object.keys(errors).map((key) => {
17-
return `${errors[key].join(' ')}`
18-
})
19-
return messages.join(' ')
18+
return `${errors[key].join(" ")}`;
19+
});
20+
return messages.join(" ");
2021
}
21-
return errorData.error?.message || errorData.error || 'An unknown error occurred'
22+
return (
23+
errorData.error?.message ||
24+
errorData.error ||
25+
"An unknown error occurred"
26+
);
2227
}
23-
return 'An unknown error occurred'
24-
} catch (err) {
25-
return 'An unknown error occurred'
28+
return "An unknown error occurred";
29+
} catch {
30+
return "An unknown error occurred";
2631
}
27-
}
32+
};

0 commit comments

Comments
 (0)