refactor: update SourceDetailSheet to use useQuery with centralized cache keys

- Replace useDocumentByChunk hook with useQuery implementation
- Use descriptive variable names (isDocumentByChunkFetching, documentByChunkFetchingError)
- Integrate with centralized cache key management
- Update all loading and error state references
- Add 5-minute stale time for document queries
This commit is contained in:
CREDO23 2025-12-04 12:38:51 +00:00
parent 7f80c9c408
commit 034e42e15e
3 changed files with 24 additions and 17 deletions

View file

@ -58,7 +58,6 @@ class BaseApiService {
*/
const defaultOptions: RequestOptions = {
headers: {
"Content-Type": "application/json",
Authorization: `Bearer ${this.bearerToken || ""}`,
},
method: "GET",
@ -211,8 +210,11 @@ class BaseApiService {
options?: Omit<RequestOptions, "method" | "responseType">
) {
return this.request(url, responseSchema, {
...options,
method: "GET",
headers: {
"Content-Type": "application/json",
},
...options,
responseType: ResponseType.JSON,
});
}
@ -224,6 +226,9 @@ class BaseApiService {
) {
return this.request(url, responseSchema, {
method: "POST",
headers: {
"Content-Type": "application/json",
},
...options,
responseType: ResponseType.JSON,
});
@ -236,6 +241,9 @@ class BaseApiService {
) {
return this.request(url, responseSchema, {
method: "PUT",
headers: {
"Content-Type": "application/json",
},
...options,
responseType: ResponseType.JSON,
});
@ -248,6 +256,9 @@ class BaseApiService {
) {
return this.request(url, responseSchema, {
method: "DELETE",
headers: {
"Content-Type": "application/json",
},
...options,
responseType: ResponseType.JSON,
});