feat(i18n): complete portal localized surfaces
This commit is contained in:
@@ -2,21 +2,28 @@
|
||||
|
||||
import { revalidatePath } from "next/cache";
|
||||
import { cleanText } from "@/server/web/form-data";
|
||||
import { resolvePortalLocale } from "@/server/i18n/resolver";
|
||||
import { requirePortalBackend } from "@/server/web/portal";
|
||||
|
||||
export async function createRevisionRequest(projectId: string, formData: FormData) {
|
||||
try {
|
||||
const { actor, service } = await requirePortalBackend();
|
||||
const { actor, context, service } = await requirePortalBackend();
|
||||
const locale = await resolvePortalLocale(context);
|
||||
const description = cleanText(formData.get("description"));
|
||||
if (!description) return { error: "Revizyon açıklaması boş olamaz." };
|
||||
if (!description) return { errorKey: "portal.revision.errors.descriptionRequired" };
|
||||
|
||||
service.requestRevision(actor, { projectId, description });
|
||||
service.requestRevision(actor, {
|
||||
projectId,
|
||||
description,
|
||||
sourceLocale: locale.locale,
|
||||
});
|
||||
revalidatePath(`/portal/projects/${projectId}`);
|
||||
revalidatePath("/portal/revisions");
|
||||
return { success: true };
|
||||
} catch (error) {
|
||||
console.error("Portal revision request failed", error);
|
||||
return {
|
||||
error: error instanceof Error ? error.message : "Revizyon talebi oluşturulamadı.",
|
||||
errorKey: "portal.revision.error",
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user