fix registration

This commit is contained in:
Tatiana Nikolaeva 2025-06-02 18:23:14 +05:00
parent 2ec9354fc1
commit 08f827267d
12 changed files with 84 additions and 88 deletions

View file

@ -1,4 +1,4 @@
import {BASE_URL, createRequestConfig, handleResponse} from "./BaseApi.ts";
import {BASE_URL, createRequestConfig, handleResponse, handleUnauthorizedError} from "./BaseApi.ts";
export interface IAnswer{
questionId: number;
answerText: string;
@ -16,6 +16,7 @@ export const getAllCompletions = async (surveyId: number) => {
return await handleResponse(response);
}
catch (error) {
handleUnauthorizedError(error);
console.error(`Error when receiving all selected responses: ${error}`);
throw error;
}
@ -36,6 +37,7 @@ export const addNewCompletion = async (surveyId: number, answer: IAnswer) => {
return await handleResponse(response)
}
catch (error) {
handleUnauthorizedError(error);
console.error(`Error when adding a new survey passage: ${error}`);
throw error;
}
@ -54,6 +56,7 @@ export const getCompletionById = async (id: number) => {
return await handleResponse(response);
}
catch (error) {
handleUnauthorizedError(error);
console.error(`Error when receiving a completed survey by id: ${error}`);
throw error;
}