Skip to content

Commit

Permalink
Passing server action prepare as prop
Browse files Browse the repository at this point in the history
  • Loading branch information
richardp23 committed Jul 30, 2024
1 parent ac0ec5d commit 714c559
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/app/prep/page.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import React from 'react';
import Header from '@/components/common/Header';
import PrepForm from '@/components/prep/PrepForm';
import { prepareInterview } from '@/app/actions/prepare';

const PrepPage = () => {
return (
Expand All @@ -12,7 +13,7 @@ const PrepPage = () => {
Please upload your resume as a .pdf file and provide the company's website URL.
</p>
<div className="max-w-2xl lg:max-w-3xl mx-auto">
<PrepForm />
<PrepForm prepareInterview={prepareInterview} />
</div>
</main>
</div>
Expand Down
7 changes: 5 additions & 2 deletions src/components/prep/PrepForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@

import React, { useState } from 'react';

import { prepareInterview } from '@/app/actions/prepare';
import CompanyNameInput from '@/components/prep/CompanyNameInput';
import FileUpload from '@/components/prep/FileUpload';
import SubmitButton from '@/components/prep/SubmitButton';

const PrepForm = () => {
interface PrepFormProps {
prepareInterview: (formData: FormData) => Promise<{ response: string }>;
}

const PrepForm: React.FC<PrepFormProps> = ({ prepareInterview }) => {
const [companyName, setCompanyName] = useState('');
const [file, setFile] = useState<File | null>(null);
const [response, setResponse] = useState<string | null>(null);
Expand Down

0 comments on commit 714c559

Please sign in to comment.