mirror of
https://github.com/Monadical-SAS/reflector.git
synced 2025-12-21 04:39:06 +00:00
Refactoring to use Error instead of string in the useError hook state variable
This commit is contained in:
@@ -2,7 +2,6 @@ import { useEffect, useState } from "react";
|
||||
import { DefaultApi, V1TranscriptsCreateRequest } from "../api/apis/DefaultApi";
|
||||
import { GetTranscript } from "../api";
|
||||
import { useError } from "../(errors)/errorContext";
|
||||
import handleError from "../(errors)/handleError";
|
||||
|
||||
type UseTranscript = {
|
||||
response: GetTranscript | null;
|
||||
@@ -37,10 +36,7 @@ const useTranscript = (api: DefaultApi): UseTranscript => {
|
||||
console.debug("New transcript created:", result);
|
||||
})
|
||||
.catch((err) => {
|
||||
const errorString = err.response || err.message || "Unknown error";
|
||||
handleError(setError, errorString, err);
|
||||
setLoading(false);
|
||||
console.error("Error creating transcript:", errorString);
|
||||
setError(err);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user