fix size components
This commit is contained in:
parent
08f827267d
commit
e6e2f68eb0
32 changed files with 238 additions and 175 deletions
|
|
@ -1,7 +1,9 @@
|
|||
import {BASE_URL, createRequestConfig, handleResponse, handleUnauthorizedError} from "./BaseApi.ts";
|
||||
export interface IAnswer{
|
||||
questionId: number;
|
||||
answerText: string;
|
||||
export interface ICompletionRequest {
|
||||
answers: Array<{
|
||||
questionId: number;
|
||||
answerText: string;
|
||||
}>;
|
||||
}
|
||||
|
||||
export const getAllCompletions = async (surveyId: number) => {
|
||||
|
|
@ -22,14 +24,11 @@ export const getAllCompletions = async (surveyId: number) => {
|
|||
}
|
||||
}
|
||||
|
||||
export const addNewCompletion = async (surveyId: number, answer: IAnswer) => {
|
||||
export const addNewCompletion = async (surveyId: number, data: ICompletionRequest) => {
|
||||
try{
|
||||
const response = await fetch(`${BASE_URL}/surveys/${surveyId}/completions`, {
|
||||
...createRequestConfig('POST'),
|
||||
body: JSON.stringify({
|
||||
questionId: answer.questionId,
|
||||
answerText: answer.answerText,
|
||||
})
|
||||
body: JSON.stringify(data)
|
||||
})
|
||||
if (!response.ok) {
|
||||
throw new Error(`Ошибка: ${response.status}`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue