Skip to content

Commit

Permalink
Added manual login button instead of error
Browse files Browse the repository at this point in the history
  • Loading branch information
aakash-a-dev committed Nov 26, 2024
1 parent 2ed4b46 commit 870dab7
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions src/components/all-jobs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,35 @@ import { Pagination, PaginationContent, PaginationItem } from './ui/pagination';
import { PaginationPages } from './ui/paginator';
import JobCard from './Jobcard';
import APP_PATHS from '@/config/path.config';
import { getServerSession } from 'next-auth';
import { options } from '@/lib/auth';
import { FormContainer } from '@/layouts/form-container';
import { Button } from './ui/button';
import Link from 'next/link';

type PaginatorProps = {
searchParams: JobQuerySchemaType;
};

const AllJobs = async ({ searchParams }: PaginatorProps) => {
const session = await getServerSession(options);

// If no session exists, show a login/register prompt
if (!session || !session.user) {
return (
<FormContainer
heading={'Login'}
description={'Need to login for accessing this!'}
>
<Link href="/signin">
<Button type="submit" className="w-full h-10" aria-label="submit">
Login
</Button>
</Link>
</FormContainer>
);
}

const [jobs, getUserBookmarks] = await Promise.all([
await getAllJobs(searchParams),
await GetUserBookmarksId(),
Expand Down

0 comments on commit 870dab7

Please sign in to comment.