fix: get API의 경우 arg를 paramArg로 전환

This commit is contained in:
2022-04-21 00:24:21 +09:00
parent 082b73f12e
commit 8fb3d9d023
+25 -10
View File
@@ -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) {