feat: APIPathGen 추상화

This commit is contained in:
2021-12-29 05:46:35 +09:00
parent def230bf30
commit ee6bec2e0d
3 changed files with 23 additions and 23 deletions
+8 -1
View File
@@ -20,4 +20,11 @@ const apiRealPath = {
},
} as const;
export const SammoRootAPI = APIPathGen(apiRealPath);
export const SammoRootAPI = APIPathGen<typeof done, typeof apiRealPath>(apiRealPath, (path: string[]) => {
return (args?: Record<string, unknown>, returnError?: boolean) => {
if (returnError) {
return callSammoAPI(path.join('/'), args, true);
}
return callSammoAPI(path.join('/'), args);
};
});