feat: Implement company offer submission page and success notification
- Added CompanyOffer component for submitting company offers with validation. - Integrated email sending functionality upon form submission. - Created a success page for company registration confirmation. - Introduced a reusable SuccessNotification component for displaying success messages. - Updated account update functionality with new fields and validation. - Enhanced user experience with back button and logo components. - Added necessary database migrations for account updates.
This commit is contained in:
@@ -1,10 +1,11 @@
|
||||
"use server";
|
||||
'use server';
|
||||
|
||||
import { createClient } from "@/utils/supabase/server";
|
||||
import { redirect } from "next/navigation";
|
||||
import { redirect } from 'next/navigation';
|
||||
|
||||
import { createClient } from '@/utils/supabase/server';
|
||||
|
||||
export const signOutAction = async () => {
|
||||
const supabase = await createClient();
|
||||
await supabase.auth.signOut();
|
||||
return redirect("/sign-in");
|
||||
return redirect('/');
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,26 +0,0 @@
|
||||
'use server';
|
||||
|
||||
import { companySchema } from '@/lib/validations/companySchema';
|
||||
|
||||
export async function submitCompanyRegistration(formData: FormData) {
|
||||
const data = {
|
||||
companyName: formData.get('companyName')?.toString() || '',
|
||||
contactPerson: formData.get('contactPerson')?.toString() || '',
|
||||
email: formData.get('email')?.toString() || '',
|
||||
phone: formData.get('phone')?.toString() || '',
|
||||
};
|
||||
|
||||
const result = companySchema.safeParse(data);
|
||||
|
||||
if (!result.success) {
|
||||
const errors = result.error.errors.map((err) => ({
|
||||
path: err.path.join('.'),
|
||||
message: err.message,
|
||||
}));
|
||||
|
||||
throw new Error(
|
||||
'Validation failed: ' +
|
||||
errors.map((e) => `${e.path}: ${e.message}`).join(', '),
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
import { z } from 'zod';
|
||||
|
||||
export const companySchema = z.object({
|
||||
export const companyOfferSchema = z.object({
|
||||
companyName: z.string({
|
||||
required_error: 'Company name is required',
|
||||
}),
|
||||
Reference in New Issue
Block a user