fix: get API의 경우 arg를 paramArg로 전환
This commit is contained in:
+25
-10
@@ -65,17 +65,32 @@ export async function callSammoAPI<ResultType extends ValidResponse, ErrorType e
|
|||||||
args = undefined;
|
args = undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const result = await ky('api.php', {
|
const result = await (() => {
|
||||||
searchParams: {
|
if (method == 'get') {
|
||||||
...paramArgs,
|
return ky('api.php', {
|
||||||
path,
|
searchParams: {
|
||||||
},
|
...paramArgs,
|
||||||
method,
|
...(args as typeof paramArgs),
|
||||||
json: args,
|
path,
|
||||||
headers: {
|
},
|
||||||
'content-type': 'application/json'
|
method,
|
||||||
|
headers: {
|
||||||
|
'content-type': 'application/json'
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}).json() as ErrorType | ResultType;
|
return ky('api.php', {
|
||||||
|
searchParams: {
|
||||||
|
...paramArgs,
|
||||||
|
path,
|
||||||
|
},
|
||||||
|
method,
|
||||||
|
json: args,
|
||||||
|
headers: {
|
||||||
|
'content-type': 'application/json'
|
||||||
|
}
|
||||||
|
});
|
||||||
|
})().json() as ErrorType | ResultType;
|
||||||
|
|
||||||
if (!result.result) {
|
if (!result.result) {
|
||||||
if (returnError) {
|
if (returnError) {
|
||||||
|
|||||||
Reference in New Issue
Block a user