"use server";

import { ServerResponse } from "@/lib/actions";
import { getLocale } from "@/lib/locales";
import { cookies } from "next/headers";

export async function getCurrentLocale() {
  return ServerResponse({ operation: true, data: getLocale() });
}

export async function setCurrentLocale(formData: FormData) {
  const locale = (formData.get("LOCALE") as string) || "en";

  const cookieStore = await cookies();
  cookieStore.set("LOCALE", locale);
}
