Skip to content

Commit 4068eaf

Browse files
MytsVmaany
authored andcommitted
Fix invalid handling of requests
1 parent 4e87605 commit 4068eaf

File tree

1 file changed

+4
-38
lines changed

1 file changed

+4
-38
lines changed

src/app/(rucio)/did/queries.ts

+4-38
Original file line numberDiff line numberDiff line change
@@ -1,47 +1,13 @@
11
import { DIDKeyValuePairsDataViewModel, DIDMetaViewModel } from "@/lib/infrastructure/data/view-model/did";
22

33
export async function didMetaQueryBase(scope: string, name: string): Promise<DIDMetaViewModel> {
4-
const req: any = {
5-
method: "GET",
6-
url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/get-did-meta`),
7-
params: {
8-
"scope": scope,
9-
"name": name
10-
},
11-
headers: new Headers({
12-
'Content-Type': 'application/json',
13-
} as HeadersInit)
14-
}
15-
16-
const res = await fetch(req.url, {
17-
method: "GET",
18-
headers: new Headers({
19-
'Content-Type': 'application/json',
20-
} as HeadersInit)
21-
})
22-
4+
const url = `${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/get-did-meta?` + new URLSearchParams({scope, name})
5+
const res = await fetch(url)
236
return await res.json()
247
}
258

269
export async function didKeyValuePairsDataQuery(scope: string, name: string): Promise<DIDKeyValuePairsDataViewModel> {
27-
const req: any = {
28-
method: "GET",
29-
url: new URL(`${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/get-did-keyvaluepairs`),
30-
params: {
31-
"scope": scope,
32-
"name": name
33-
},
34-
headers: new Headers({
35-
'Content-Type': 'application/json',
36-
} as HeadersInit)
37-
}
38-
39-
const res = await fetch(req.url, {
40-
method: "GET",
41-
headers: new Headers({
42-
'Content-Type': 'application/json',
43-
} as HeadersInit)
44-
})
45-
10+
const url = `${process.env.NEXT_PUBLIC_WEBUI_HOST}/api/feature/get-did-keyvaluepairs?` + new URLSearchParams({scope, name})
11+
const res = await fetch(url)
4612
return await res.json()
4713
}

0 commit comments

Comments
 (0)