Skip to content

Commit 1ce4d48

Browse files
committed
fix conflicts with ui template
1 parent c678d1a commit 1ce4d48

34 files changed

+551
-1336
lines changed

actions/logout.ts

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
"use server";
2-
import { signOut } from "@/auth";
1+
import { signOut } from "next-auth/react";
32
import { loginRoute } from "@/routes";
43

54
export const logout = async () => {
65
await signOut({
7-
redirectTo: loginRoute,
6+
callbackUrl: loginRoute,
87
});
98
};

app/api/auth/login/route.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { LoginSchema } from "@/schemas";
1+
import { loginSchema } from "@/schemas";
22
import { signIn } from "@/auth";
33
import { DEFAULT_LOGIN_REDIRECT } from "@/routes";
44
import { AuthError } from "next-auth";
@@ -10,7 +10,7 @@ import sanitizeUser from "@/utils/sanitize-user";
1010
export async function POST(request: Request, response: Response) {
1111
try {
1212
const body = await request.json();
13-
const validatedFields = LoginSchema.safeParse(body);
13+
const validatedFields = loginSchema.safeParse(body);
1414
console.log(validatedFields);
1515
if (!validatedFields.success) {
1616
return Response.json(

app/api/link/[linkId]/route.ts

+19-15
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@ import { db } from "@/lib/db";
33
import { decode } from "next-auth/jwt";
44
import { changeCustomSuffixSchema } from "@/schemas";
55

6-
76
export async function GET(
87
req: Request,
98
{ params }: { params: { linkId: string } },
@@ -31,7 +30,7 @@ export async function PATCH(
3130
) {
3231
try {
3332
let userId;
34-
const {linkId} = params
33+
const { linkId } = params;
3534

3635
// Check for Bearer token
3736
const authHeader = request.headers.get("Authorization");
@@ -66,35 +65,40 @@ export async function PATCH(
6665
const validatedFields = changeCustomSuffixSchema.safeParse(body);
6766
console.log(validatedFields);
6867
if (!validatedFields.success) {
69-
return Response.json({ error: "Invalid fields" }, { status: 400 });
68+
return Response.json({ success:false, message: "Invalid fields" }, { status: 400 });
7069
}
7170

7271
const { customSuffix } = validatedFields.data;
73-
7472

75-
const isExisting = !!await db.link.findUnique({
73+
const isExisting = !!(await db.link.findUnique({
7674
where: {
7775
customSuffix,
7876
},
79-
});
77+
}));
8078

81-
if (isExisting){
82-
return Response.json( {success: false, error: "custom suffix in use"}, {status: 409 })
79+
if (isExisting) {
80+
return Response.json(
81+
{ success: false, message: "custom suffix in use" },
82+
{ status: 409 },
83+
);
8384
}
8485
const data = await db.link.update({
8586
where: {
8687
id: linkId,
87-
userId
88+
userId,
8889
},
89-
data:{
90-
customSuffix
91-
}
92-
})
93-
return Response.json({ success: true, data }, { status: 200 });
90+
data: {
91+
customSuffix,
92+
},
93+
});
94+
return Response.json(
95+
{ success: true, message: "Custom suffix changed succesfully" },
96+
{ status: 200 },
97+
);
9498
} catch (error) {
9599
console.log(error);
96100
return Response.json(
97-
{ error: "An unexpected error occurred" },
101+
{ success: false, message: "An unexpected error occurred" },
98102
{ status: 500 },
99103
);
100104
}

app/dashboard/employee/[employeeId]/page.tsx

-28
This file was deleted.

app/dashboard/employee/page.tsx

-69
This file was deleted.

app/dashboard/kanban/page.tsx

-25
This file was deleted.
File renamed without changes.

app/dashboard/user/page.tsx app/dashboard/link/page.tsx

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
import { Breadcrumbs } from '@/components/breadcrumbs';
22
import PageContainer from '@/components/layout/page-container';
3-
import { UserClient } from '@/components/tables/user-tables/client';
4-
import { users } from '@/constants/data';
3+
import { LinkClient } from '@/components/tables/user-tables/client';
4+
import { links } from '@/constants/data';
55

66
const breadcrumbItems = [
77
{ title: 'Dashboard', link: '/dashboard' },
8-
{ title: 'User', link: '/dashboard/user' }
8+
{ title: 'Link', link: '/dashboard/link' }
99
];
1010
export default function page() {
1111
return (
1212
<PageContainer>
1313
<div className="space-y-2">
1414
<Breadcrumbs items={breadcrumbItems} />
15-
<UserClient data={users} />
15+
<LinkClient data={links} />
1616
</div>
1717
</PageContainer>
1818
);

0 commit comments

Comments
 (0)