node.js이므로 generator 형식 변경
This commit is contained in:
@@ -3,12 +3,14 @@ import type { APITail, RawArgType } from "../apiStructure/defs";
|
||||
import { structure } from "../apiStructure/sammoRootAPI";
|
||||
import { callClientAPI } from "./generator";
|
||||
|
||||
const apiRoot = process.env.API_ROOT_PATH ?? process.env.VITE_API_ROOT_PATH ?? '/api';
|
||||
|
||||
export const SammoRootAPI = APIPathGen(structure, (path: string[], tail: APITail, pathParam) => {
|
||||
const method = tail.reqType;
|
||||
return (args?: RawArgType, returnError?: boolean) => {
|
||||
if (returnError) {
|
||||
return callClientAPI(method, path.join('/'), args, pathParam, true);
|
||||
return callClientAPI(method, apiRoot, path.join('/'), args, pathParam, returnError);
|
||||
}
|
||||
return callClientAPI(method, path.join('/'), args, pathParam);
|
||||
return callClientAPI(method, apiRoot, path.join('/'), args, pathParam);
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user