fix: message styling
This commit is contained in:
@@ -42,4 +42,5 @@ export async function getSessionUserId(): Promise<string | null> {
|
||||
export async function deleteSession() {
|
||||
const store = await cookies();
|
||||
store.delete("session");
|
||||
store.delete("refresh_token");
|
||||
}
|
||||
+10
-10
@@ -57,7 +57,7 @@ export const submitCitizenshipApplication = formAction(citizenshipApplicationSch
|
||||
if (isEuResidentYes) {
|
||||
const region = await prisma.region.findUnique({ where: { id: data.regionId } });
|
||||
if (!region) {
|
||||
throw new AppError("Selected region is invalid.", { regionId: ["Selected region is invalid."] });
|
||||
throw new AppError("Selected region is invalid", { regionId: ["Selected region is invalid"] });
|
||||
}
|
||||
regionName = region.name;
|
||||
}
|
||||
@@ -112,15 +112,15 @@ export async function approveApplication(id: string): Promise<ActionResult> {
|
||||
const user = await requireAdmin();
|
||||
|
||||
const application = await prisma.citizenshipApplication.findUnique({ where: { id } });
|
||||
if (!application) throw new AppError("Application not found.");
|
||||
if (application.status !== "PENDING") throw new AppError("This application is no longer pending review.");
|
||||
if (application.userId === user.id) throw new AppError("You cannot approve your own application.");
|
||||
if (!application) throw new AppError("Application not found");
|
||||
if (application.status !== "PENDING") throw new AppError("This application is no longer pending review");
|
||||
if (application.userId === user.id) throw new AppError("You cannot approve your own application");
|
||||
|
||||
const existingCitizenship = await prisma.citizenship.findFirst({
|
||||
where: { userId: application.userId, revokedAt: null },
|
||||
});
|
||||
if (existingCitizenship) {
|
||||
throw new AppError("This applicant is already a citizen.");
|
||||
throw new AppError("This applicant is already a citizen");
|
||||
}
|
||||
|
||||
const now = new Date();
|
||||
@@ -158,12 +158,12 @@ export async function rejectApplication(id: string, reason: string): Promise<Act
|
||||
const user = await requireAdmin();
|
||||
|
||||
const application = await prisma.citizenshipApplication.findUnique({ where: { id } });
|
||||
if (!application) throw new AppError("Application not found.");
|
||||
if (application.status !== "PENDING") throw new AppError("This application is no longer pending review.");
|
||||
if (application.userId === user.id) throw new AppError("You cannot reject your own application.");
|
||||
if (!application) throw new AppError("Application not found");
|
||||
if (application.status !== "PENDING") throw new AppError("This application is no longer pending review");
|
||||
if (application.userId === user.id) throw new AppError("You cannot reject your own application");
|
||||
|
||||
const trimmedReason = reason.trim();
|
||||
if (!trimmedReason) throw new AppError("A rejection reason is required.");
|
||||
if (!trimmedReason) throw new AppError("A rejection reason is required");
|
||||
|
||||
await prisma.citizenshipApplication.update({
|
||||
where: { id, status: "PENDING" },
|
||||
@@ -184,7 +184,7 @@ export async function renounceCitizenship(): Promise<ActionResult> {
|
||||
const user = await requireUser();
|
||||
|
||||
const citizenship = await getActiveCitizenship(user.id);
|
||||
if (!citizenship) throw new AppError("Citizenship not found.");
|
||||
if (!citizenship) throw new AppError("Citizenship not found");
|
||||
|
||||
await prisma.citizenship.update({ where: { id: citizenship.id }, data: { revokedAt: new Date() } });
|
||||
revalidatePath("/account/citizenship");
|
||||
|
||||
+1
-1
@@ -10,6 +10,6 @@ export async function requireUser() {
|
||||
|
||||
export async function requireAdmin() {
|
||||
const user = await requireUser();
|
||||
if (!user.isAdmin) throw new AppError("You do not have permission to perform this action.");
|
||||
if (!user.isAdmin) throw new AppError("You do not have permission to perform this action");
|
||||
return user;
|
||||
}
|
||||
Reference in New Issue
Block a user