enhancement: implement api client in remaining places

This commit is contained in:
Siddhant Rai
2024-07-24 23:08:42 +05:30
parent 7c6532f145
commit 0c062a8485
7 changed files with 90 additions and 87 deletions

View File

@@ -1,13 +1,14 @@
import React, { useRef } from 'react';
import { useCallback, useEffect, useState } from 'react';
import React, { useCallback, useEffect, useRef, useState } from 'react';
import { useDropzone } from 'react-dropzone';
import { useTranslation } from 'react-i18next';
import { useDispatch } from 'react-redux';
import userService from '../api/services/userService';
import Dropdown from '../components/Dropdown';
import Input from '../components/Input';
import { ActiveState } from '../models/misc';
import { getDocs } from '../preferences/preferenceApi';
import { setSelectedDocs, setSourceDocs } from '../preferences/preferenceSlice';
import Dropdown from '../components/Dropdown';
import { useTranslation } from 'react-i18next';
import Input from '../components/Input';
function Upload({
modalState,
@@ -111,8 +112,8 @@ function Upload({
if ((progress?.percentage ?? 0) < 100) {
timeoutID = setTimeout(() => {
const apiHost = import.meta.env.VITE_API_HOST;
fetch(`${apiHost}/api/task_status?task_id=${progress?.taskId}`)
userService
.getTaskStatus(progress?.taskId as string)
.then((data) => data.json())
.then((data) => {
if (data.status == 'SUCCESS') {