Otypování requestů na API

This commit is contained in:
2025-01-08 17:58:49 +01:00
parent 414664b2d7
commit e611d36995
10 changed files with 126 additions and 66 deletions

View File

@@ -1,12 +1,12 @@
import { FeatureRequest } from "../types";
import { FeatureRequest, UpdateFeatureVoteRequest } from "../types";
import { api } from "./Api";
const VOTING_API_PREFIX = '/api/voting';
export const getFeatureVotes = async () => {
return await api.get<any>(`${VOTING_API_PREFIX}/getVotes`);
return await api.get<FeatureRequest[]>(`${VOTING_API_PREFIX}/getVotes`);
}
export const updateFeatureVote = async (option: FeatureRequest, active: boolean) => {
return await api.post<any, any>(`${VOTING_API_PREFIX}/updateVote`, { option, active });
return await api.post<UpdateFeatureVoteRequest, void>(`${VOTING_API_PREFIX}/updateVote`, { option, active });
}