Skip to content

Commit

Permalink
fix: more bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
VineeTagarwaL-code committed Sep 29, 2024
1 parent 3e23c45 commit 69e8d1c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
7 changes: 3 additions & 4 deletions src/actions/job.action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,15 @@ import {
} from '@/lib/validators/jobs.validator';
import { getJobFilters } from '@/services/jobs.services';
import { ServerActionReturnType } from '@/types/api.types';

import { getServerSession } from 'next-auth';
import { authOptions } from '@/lib/authOptions';

import {
getAllJobsAdditonalType,
getAllRecommendedJobs,
getJobType,
} from '@/types/jobs.types';


type additional = {
isVerifiedJob: boolean;
Expand Down Expand Up @@ -73,7 +72,7 @@ export const createJob = withServerActionAsyncCatcher<
address,
companyLogo,
workMode,
isVerifiedJob: false, // Default to false since there's no session to check for admin role
isVerifiedJob: false,
},
});
const message = 'Job created successfully, waiting for admin approval';
Expand Down
1 change: 1 addition & 0 deletions src/components/job-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,7 @@ const PostJobForm = () => {
(await submitImage(file)) ?? 'https://wwww.example.com';
``;
const response = await createJob(data);

if (!response.status) {
return toast({
title: response.message || 'Error',
Expand Down
2 changes: 1 addition & 1 deletion src/lib/validators/jobs.validator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export const JobPostSchema = z
type: z.nativeEnum(EmployementType, {
message: 'Employment Type is Required',
}),
skills: z.array(z.string()),
skills: z.array(z.string()).optional(),
category: z.string(),
companyEmail: z.string().email('Invalid email').min(1, 'Email is required'),
companyBio: z.string().min(1, 'Company Bio is required'),
Expand Down
2 changes: 1 addition & 1 deletion src/middleware.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ export async function middleware(req: NextRequest) {
return NextResponse.redirect(new URL('/signin', req.url));
}
if (pathname === '/create' && token?.role !== 'ADMIN') {
return NextResponse.redirect(new URL('/', req.url)); // Redirect to an unauthorized page
return NextResponse.redirect(new URL('/', req.url));
}
return NextResponse.next();
}
Expand Down

0 comments on commit 69e8d1c

Please sign in to comment.