api client refactor
This commit is contained in:
17
apps/website/lib/services/sponsors/SponsorService.ts
Normal file
17
apps/website/lib/services/sponsors/SponsorService.ts
Normal file
@@ -0,0 +1,17 @@
|
||||
import { api as api } from '../../api';
|
||||
import { presentSponsor } from '../../presenters';
|
||||
import { SponsorViewModel } from '../../view-models';
|
||||
|
||||
export async function getAllSponsors(): Promise<SponsorViewModel[]> {
|
||||
const dto = await api.sponsors.getAll();
|
||||
return dto.sponsors.map(s => presentSponsor(s));
|
||||
}
|
||||
|
||||
export async function createSponsor(input: any): Promise<any> {
|
||||
return await api.sponsors.create(input);
|
||||
}
|
||||
|
||||
export async function getSponsorDashboard(sponsorId: string): Promise<any> {
|
||||
const dto = await api.sponsors.getDashboard(sponsorId);
|
||||
return dto;
|
||||
}
|
||||
11
apps/website/lib/services/sponsors/SponsorshipService.ts
Normal file
11
apps/website/lib/services/sponsors/SponsorshipService.ts
Normal file
@@ -0,0 +1,11 @@
|
||||
import { api as api } from '../../api';
|
||||
|
||||
export async function getSponsorshipPricing(): Promise<any> {
|
||||
const dto = await api.sponsors.getPricing();
|
||||
return dto;
|
||||
}
|
||||
|
||||
export async function getSponsorSponsorships(sponsorId: string): Promise<any> {
|
||||
const dto = await api.sponsors.getSponsorships(sponsorId);
|
||||
return dto;
|
||||
}
|
||||
Reference in New Issue
Block a user