website refactor
This commit is contained in:
@@ -8,7 +8,7 @@ import type { CreateLeagueInputDTO } from '@/lib/types/generated/CreateLeagueInp
|
||||
/**
|
||||
* CreateLeagueMutation
|
||||
*
|
||||
* Framework-agnostic mutation for league creation.
|
||||
* Framework-agnostic mutation for creating leagues.
|
||||
* Can be called from Server Actions or other contexts.
|
||||
*/
|
||||
export class CreateLeagueMutation {
|
||||
@@ -24,12 +24,12 @@ export class CreateLeagueMutation {
|
||||
this.service = new LeagueService(apiClient);
|
||||
}
|
||||
|
||||
async createLeague(input: CreateLeagueInputDTO): Promise<Result<void, string>> {
|
||||
async execute(input: CreateLeagueInputDTO): Promise<Result<string, string>> {
|
||||
try {
|
||||
await this.service.createLeague(input);
|
||||
return Result.ok(undefined);
|
||||
const result = await this.service.createLeague(input);
|
||||
return Result.ok(result.leagueId);
|
||||
} catch (error) {
|
||||
console.error('createLeague failed:', error);
|
||||
console.error('CreateLeagueMutation failed:', error);
|
||||
return Result.err('Failed to create league');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user