Skip to content

Commit

Permalink
removed login workflow (code100x#295)
Browse files Browse the repository at this point in the history
* removed login and ModeToggle button(for dark/light mode switch) added infinite scroll for companies logo added debouncing and skeleton in place of jobs on load of screen

* removed unwanted images

* fixes

* removed login workflow

* fixed prettier

* removed unwanted files
  • Loading branch information
anuragnegi000 authored Sep 3, 2024
1 parent 3c76bef commit 041b85b
Show file tree
Hide file tree
Showing 8 changed files with 8 additions and 338 deletions.
17 changes: 6 additions & 11 deletions src/actions/job.action.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
'use server';
import { ADMIN_ROLE } from '@/config/app.config';
import prisma from '@/config/prisma.config';
import { withSession } from '@/lib/session';
import { withServerActionAsyncCatcher } from '@/lib/async-catch';
import { SuccessResponse } from '@/lib/success';
import {
Expand All @@ -19,12 +17,11 @@ import { getAllJobsAdditonalType, getJobType } from '@/types/jobs.types';
type additional = {
isVerifiedJob: boolean;
};
export const createJob = withSession<
export const createJob = withServerActionAsyncCatcher<
JobPostSchemaType,
ServerActionReturnType<additional>
>(async (session, data) => {
>(async (data) => {
const result = JobPostSchema.parse(data);
const isVerifiedJob = session.user.role === ADMIN_ROLE;
const {
companyName,
location,
Expand All @@ -37,22 +34,20 @@ export const createJob = withSession<
} = result;
await prisma.job.create({
data: {
userId: session.user.id,
userId: '1', // Default to 1 since there's no session to check for user id
title,
description,
companyName,
hasSalaryRange,
minSalary,
maxSalary,
isVerifiedJob,
location,
workMode,
isVerifiedJob: false, // Default to false since there's no session to check for admin role
},
});
const message = isVerifiedJob
? 'Job created successfully'
: 'Job created successfully, waiting for admin approval';
const additonal = { isVerifiedJob };
const message = 'Job created successfully, waiting for admin approval';
const additonal = { isVerifiedJob: false };
return new SuccessResponse(message, 201, additonal).serialize();
});

Expand Down
17 changes: 0 additions & 17 deletions src/app/(auth)/signin/page.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions src/app/(auth)/signup/page.tsx

This file was deleted.

5 changes: 0 additions & 5 deletions src/app/api/auth/[...nextauth]/route.ts

This file was deleted.

125 changes: 0 additions & 125 deletions src/components/auth/signin.tsx

This file was deleted.

139 changes: 0 additions & 139 deletions src/components/auth/signup.tsx

This file was deleted.

26 changes: 1 addition & 25 deletions src/middleware.tsx
Original file line number Diff line number Diff line change
@@ -1,28 +1,4 @@
import APP_PATHS from '@/config/path.config';
import { getToken } from 'next-auth/jwt';
import { NextRequest, NextResponse } from 'next/server';

const authRoutes = ['/signup', '/signin'];
const privateRoutes = ['/create', '/setting'];
export async function middleware(request: NextRequest) {
const session = await getToken({
req: request,
secret: process.env.NEXTAUTH_SECRET,
});
const currentPath = request.nextUrl.pathname;
if (!session && privateRoutes.includes(currentPath)) {
return NextResponse.redirect(
new URL(
`${APP_PATHS.SIGNIN}?next=${encodeURIComponent(currentPath)}`,
request.url
)
);
}
if (authRoutes.includes(currentPath) && session) {
return NextResponse.redirect(new URL(`${APP_PATHS.HOME}`, request.url));
}
return NextResponse.next();
}
export async function middleware() {}

export const config = {
matcher: ['/((?!api|_next/static|_next/image|favicon.ico).*)'],
Expand Down
2 changes: 1 addition & 1 deletion tailwind.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ const config = {
fontFamily: {
sans: ['var(--font-sans)', ...fontFamily.sans],
},

colors: {
'stroke-primary': 'hsl(var(--stroke-primary))',
'stroke-secondary': 'hsl(var(--stroke-secondary))',
Expand Down

0 comments on commit 041b85b

Please sign in to comment.