feat: add import-jobs route constants and client handler
This commit is contained in:
1 parent
61e2dad029
commit
93a4cabb01
2 files changed
+23
-1
No files matched your search
@@ -94,4 +94,8 @@ export const SHARE_KEY_PATH = BASE_API_ENDPOINT + "/share-key";
|
||||
|
||||
// Import Shared
|
||||
export const IMPORT_SHARED_PATH = BASE_API_ENDPOINT + "/import-shared";
|
||||
export const IMPORT_SHARED_UPLOAD_ALL_PATH = BASE_API_ENDPOINT + "/import-shared/upload-all";
|
||||
export const IMPORT_SHARED_UPLOAD_ALL_PATH = BASE_API_ENDPOINT + "/import-shared/upload-all";
|
||||
|
||||
// Import Jobs (queue)
|
||||
export const IMPORT_JOBS_PATH = BASE_API_ENDPOINT + "/import-jobs";
|
||||
export const IMPORT_JOB_PATH = (jobId: string) => BASE_API_ENDPOINT + "/import-jobs/" + jobId;
|
||||
@@ -0,0 +1,18 @@
|
||||
import { IMPORT_JOBS_PATH, IMPORT_JOB_PATH } from "@/config/routes";
|
||||
import API from "@/lib/api";
|
||||
|
||||
export interface CreateImportJobParams {
|
||||
platform: string;
|
||||
url: string;
|
||||
urlConfig: Record<string, unknown>;
|
||||
importData: Record<string, unknown>;
|
||||
assets: { id: string; [key: string]: unknown }[];
|
||||
}
|
||||
|
||||
export const createImportJob = async (params: CreateImportJobParams): Promise<{ jobId: string }> => {
|
||||
return API.post(IMPORT_JOBS_PATH, params);
|
||||
};
|
||||
|
||||
export const getImportJob = async (jobId: string) => {
|
||||
return API.get(IMPORT_JOB_PATH(jobId));
|
||||
};
|
||||
Reference in new issue
Block a user