Files
gridpilot.gg/apps/website/app/actions/profileActions.ts
2026-01-17 15:46:55 +01:00

21 lines
678 B
TypeScript

'use server';
import { revalidatePath } from 'next/cache';
import { Result } from '@/lib/contracts/Result';
import { routes } from '@/lib/routing/RouteConfig';
import { UpdateDriverProfileMutation } from '@/lib/mutations/drivers/UpdateDriverProfileMutation';
export async function updateProfileAction(
updates: { bio?: string; country?: string },
): Promise<Result<void, string>> {
const mutation = new UpdateDriverProfileMutation();
const result = await mutation.execute({ bio: updates.bio, country: updates.country });
if (result.isErr()) {
return Result.err(result.getError());
}
revalidatePath(routes.protected.profile);
return Result.ok(undefined);
}