Merge branch 'dev' into 'staging'

fetcher throws error when quizId is ""

See merge request frontend/squzanswerer!128
This commit is contained in:
Nastya 2024-05-01 08:41:11 +00:00
commit d5ed4d7356

@ -42,7 +42,7 @@ type PublicationMakeRequestParams = {
url: string;
body: FormData;
method: "POST";
}
};
export const publicationMakeRequest = ({ url, body }: PublicationMakeRequestParams) => {
return axios(url, {
@ -105,6 +105,8 @@ export async function getData(quizId: string): Promise<{
}
export async function getQuizData(quizId: string) {
if (!quizId) throw new Error("No quiz id");
const response = await getData(quizId);
const quizDataResponse = response.data;
@ -127,7 +129,7 @@ type SendAnswerProps = {
body: string | string[];
qid: string;
preview: boolean;
}
};
export function sendAnswer({ questionId, body, qid, preview }: SendAnswerProps) {
if (preview) return;
@ -159,7 +161,7 @@ type SendFileParams = {
preview: boolean;
};
qid: string;
}
};
type Answer = {
question_id: string;
@ -201,7 +203,7 @@ export type SendFCParams = {
};
qid: string;
preview: boolean;
}
};
export function sendFC({ questionId, body, qid, preview }: SendFCParams) {
if (preview) return;