kyc user and upload partial update encrypt nik and picture
This commit is contained in:
@@ -4,6 +4,7 @@ import { getServerSession } from "next-auth";
|
||||
import { authOptions } from "@/lib/auth";
|
||||
import { createTripSchema, tripImageUrlsSchema } from "./schemas";
|
||||
import { tripService } from "@/server/services/trip.service";
|
||||
import { organizerService } from "@/server/services/organizer.service";
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { tripStoredInstantFromYmd } from "@/lib/trip-dates";
|
||||
|
||||
@@ -33,6 +34,16 @@ export async function createTripAction(formData: FormData) {
|
||||
return { error: result.error.issues[0].message };
|
||||
}
|
||||
|
||||
if (result.data.price > 0) {
|
||||
const approved = await organizerService.isApproved(session.user.id);
|
||||
if (!approved) {
|
||||
return {
|
||||
error:
|
||||
"Untuk membuat trip berbayar, akun kamu perlu diverifikasi. Silakan lengkapi verifikasi di /verify.",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
const imageUrlsRaw = formData
|
||||
.getAll("imageUrls")
|
||||
.map((v) => (v as string).trim())
|
||||
|
||||
Reference in New Issue
Block a user