"use server";

import { cookies } from "next/headers";
import { revalidatePath } from "next/cache";
import {CURRENT_CURRENCY} from "@/utils/constants";
import {currencyCookieOptions} from "@/utils/constants/server";
export async function switchCurrencyAction(currency: string) {

    const cookieStore = await cookies()

    cookieStore.set(CURRENT_CURRENCY,currency,currencyCookieOptions);

    revalidatePath('/', 'layout'); // 根 layout.tsx下的所有页面，缓存都失效
}