Yaltopia-FIFA/actions/matches.ts
Kirubel-Kibru-Yaltopia 89440985f1
Some checks failed
Deploy to Cloudflare Workers / deploy (push) Has been cancelled
x
2026-05-24 21:46:10 +03:00

52 lines
1.4 KiB
TypeScript

"use server";
import { revalidatePath } from "next/cache";
import { createClient } from "@/lib/supabase/server";
import * as matches from "@/lib/services/matches";
export async function proposeSchedule(matchId: string, scheduledAt: string) {
const supabase = await createClient();
await matches.proposeSchedule(supabase, matchId, scheduledAt);
revalidatePath("/leagues");
}
export async function signSchedule(matchId: string, teamId: string) {
const supabase = await createClient();
await matches.signSchedule(supabase, matchId, teamId);
revalidatePath("/leagues");
}
export async function submitResult(
matchId: string,
teamId: string,
homeScore: number,
awayScore: number
) {
const supabase = await createClient();
await matches.submitResult(supabase, matchId, teamId, homeScore, awayScore);
revalidatePath("/leagues");
}
export async function approveResult(matchId: string) {
const supabase = await createClient();
await matches.approveResult(supabase, matchId);
revalidatePath("/leagues");
}
export async function setResultByManager(
matchId: string,
homeScore: number,
awayScore: number,
note?: string
) {
const supabase = await createClient();
await matches.setResultByManager(
supabase,
matchId,
homeScore,
awayScore,
note
);
revalidatePath("/leagues");
}