Skip to content

Commit 75212d0

Browse files
committed
Swap datatypes info request to fetch client
1 parent 5cb524c commit 75212d0

File tree

1 file changed

+12
-6
lines changed

1 file changed

+12
-6
lines changed

client/src/api/datatypes.ts

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
1-
import axios from "axios";
2-
1+
import { GalaxyApi } from "@/api";
32
import type { components } from "@/api";
4-
import { withPrefix } from "@/utils/redirect";
53
import { rethrowSimple } from "@/utils/simple-error";
64

75
export type CompositeFileInfo = components["schemas"]["CompositeFileInfo"];
@@ -10,10 +8,18 @@ export type DatatypeDetails = components["schemas"]["DatatypeDetails"];
108
/**
119
* Get details about a specific datatype
1210
*/
13-
export async function fetchDatatypeDetails(extension: string) {
11+
export async function fetchDatatypeDetails(extension: string): Promise<DatatypeDetails> {
1412
try {
15-
const { data } = await axios.get(withPrefix(`/api/datatypes/${extension}`));
16-
return data;
13+
const { GET } = GalaxyApi();
14+
const { data } = await GET("/api/datatypes/{datatype}", {
15+
params: {
16+
path: { datatype: extension },
17+
},
18+
});
19+
if (!data) {
20+
throw new Error(`Failed to fetch datatype details for ${extension}`);
21+
}
22+
return data as DatatypeDetails;
1723
} catch (error) {
1824
rethrowSimple(error);
1925
}

0 commit comments

Comments
 (0)