diff options
Diffstat (limited to 'src/client')
| -rw-r--r-- | src/client/views/StyleProviderQuiz.tsx | 20 |
1 files changed, 6 insertions, 14 deletions
diff --git a/src/client/views/StyleProviderQuiz.tsx b/src/client/views/StyleProviderQuiz.tsx index 1f2ad1485..dd048e691 100644 --- a/src/client/views/StyleProviderQuiz.tsx +++ b/src/client/views/StyleProviderQuiz.tsx @@ -19,6 +19,7 @@ import { FieldViewProps } from './nodes/FieldView'; import { ImageBox } from './nodes/ImageBox'; import { ImageUtility } from './nodes/generativeFill/generativeFillUtils/ImageHandler'; import './StyleProviderQuiz.scss'; +import { Networking } from '../Network'; export namespace styleProviderQuiz { enum quizMode { @@ -85,21 +86,12 @@ export namespace styleProviderQuiz { if (!quizBoxes.length) { imgBox.Loading = true; - const img = { - file: i ? i : imgBox.paths[0], - drag: i ? 'drag' : 'full', - smart: quiz, - }; - const response = await axios.post('http://localhost:105/labels/', img, { - headers: { - 'Content-Type': 'application/json', - }, - }); - if (response.data['boxes'].length != 0) { - createBoxes(imgBox, response.data['boxes'], response.data['text']); - } else { - imgBox.Loading = false; + const response = await Networking.PostToServer('/labels', { file: i ? i : imgBox.paths[0], drag: i ? 'drag' : 'full', smart: quiz }); + const parsedResponse = JSON.parse(response.result.replace(/'/g, '"')); + if (parsedResponse['boxes'].length != 0) { + createBoxes(imgBox, parsedResponse['boxes'], parsedResponse['text']); } + imgBox.Loading = false; } else quizBoxes.forEach(box => (box.hidden = false)); } |
