fix add new answer
This commit is contained in:
parent
15ec6b9632
commit
6eb03dc112
10 changed files with 87 additions and 160 deletions
|
|
@ -51,30 +51,6 @@ export const getAllSurveys = async (): Promise<ISurvey[]> => {
|
|||
* postNewSurvey - добавление нового опроса
|
||||
* @param survey
|
||||
*/
|
||||
// export const postNewSurvey = async (survey: INewSurvey): Promise<ISurvey> => {
|
||||
// const token = localStorage.getItem("token");
|
||||
// if (!token) {
|
||||
// throw new Error("Токен отсутствует");
|
||||
// }
|
||||
//
|
||||
// try{
|
||||
// const response = await fetch(`${BASE_URL}/surveys`, {
|
||||
// ...createRequestConfig('POST'),
|
||||
// body: JSON.stringify(survey)
|
||||
// })
|
||||
//
|
||||
// // return await handleResponse(response);
|
||||
//
|
||||
// if (response.status === 200) {
|
||||
// return await handleResponse(response);
|
||||
// }
|
||||
// throw new Error(`Ожидался код 200, получен ${response.status}`);
|
||||
// } catch (error) {
|
||||
// console.error(`Error when adding a new survey: ${error}`);
|
||||
// throw error;
|
||||
// }
|
||||
// }
|
||||
|
||||
export const postNewSurvey = async (survey: INewSurvey): Promise<ISurvey> => {
|
||||
const token = localStorage.getItem("token");
|
||||
if (!token) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue