Merge branch 'dev' into 'staging'
fetcher throws error when quizId is "" See merge request frontend/squzanswerer!128
This commit is contained in:
commit
d5ed4d7356
@ -42,7 +42,7 @@ type PublicationMakeRequestParams = {
|
|||||||
url: string;
|
url: string;
|
||||||
body: FormData;
|
body: FormData;
|
||||||
method: "POST";
|
method: "POST";
|
||||||
}
|
};
|
||||||
|
|
||||||
export const publicationMakeRequest = ({ url, body }: PublicationMakeRequestParams) => {
|
export const publicationMakeRequest = ({ url, body }: PublicationMakeRequestParams) => {
|
||||||
return axios(url, {
|
return axios(url, {
|
||||||
@ -105,6 +105,8 @@ export async function getData(quizId: string): Promise<{
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function getQuizData(quizId: string) {
|
export async function getQuizData(quizId: string) {
|
||||||
|
if (!quizId) throw new Error("No quiz id");
|
||||||
|
|
||||||
const response = await getData(quizId);
|
const response = await getData(quizId);
|
||||||
const quizDataResponse = response.data;
|
const quizDataResponse = response.data;
|
||||||
|
|
||||||
@ -127,7 +129,7 @@ type SendAnswerProps = {
|
|||||||
body: string | string[];
|
body: string | string[];
|
||||||
qid: string;
|
qid: string;
|
||||||
preview: boolean;
|
preview: boolean;
|
||||||
}
|
};
|
||||||
|
|
||||||
export function sendAnswer({ questionId, body, qid, preview }: SendAnswerProps) {
|
export function sendAnswer({ questionId, body, qid, preview }: SendAnswerProps) {
|
||||||
if (preview) return;
|
if (preview) return;
|
||||||
@ -159,7 +161,7 @@ type SendFileParams = {
|
|||||||
preview: boolean;
|
preview: boolean;
|
||||||
};
|
};
|
||||||
qid: string;
|
qid: string;
|
||||||
}
|
};
|
||||||
|
|
||||||
type Answer = {
|
type Answer = {
|
||||||
question_id: string;
|
question_id: string;
|
||||||
@ -201,7 +203,7 @@ export type SendFCParams = {
|
|||||||
};
|
};
|
||||||
qid: string;
|
qid: string;
|
||||||
preview: boolean;
|
preview: boolean;
|
||||||
}
|
};
|
||||||
|
|
||||||
export function sendFC({ questionId, body, qid, preview }: SendFCParams) {
|
export function sendFC({ questionId, body, qid, preview }: SendFCParams) {
|
||||||
if (preview) return;
|
if (preview) return;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user