frontend/src/common/api.js
/** Fetches the current status of the import queue */
Fetches the current status of the import queue
Fetches the current status of the import queue
function useCourseImportStatus(courseId, options = {}) {
  const [repeat, setRepeat] = useState(false);
  return useQuery(
    ["course", courseId, "import", "status"],
    () => apiClient(`courses/${courseId}/import-queue`),
    {
      onSuccess({ status } = {}) {
        setRepeat(status === "working");
        options.onSuccess?.({ status });
      },
      refetchInterval: repeat ? 1000 : null,
    }
  );
}
function useCourseImportStatus ( courseId , options = { } ) { const [ repeat , setRepeat ] = useState ( false ) ; return useQuery ( [ "course" , courseId , "import" , "status" ] , ( ) => apiClient ( ` ${ courseId } ` ) , { onSuccess ( { status } = { } ) { setRepeat ( status === "working" ) ; options . onSuccess ?. ( { status } ) ; } , refetchInterval : repeat ? 1000 : null , } ) ; }
Fetches the current status of the import queue
Fetches the current status of the import queue