Initial commit from ZIP
This commit is contained in:
commit
378d4692a9
454 files changed
+40367
No files matched your search
Executable
+60
@@ -0,0 +1,60 @@
|
||||
import API from './axiosConfig';
|
||||
import { DesignStageResponse, DesignStageFileRequest, DesignStageFileResponse } from 'interfaces/API/draft';
|
||||
import objectToFormDataConverter from 'helpers/objectToFormDataConverter';
|
||||
import { AxiosResponse } from 'axios';
|
||||
|
||||
const getPrintingFileById = async (printingFileId: number): Promise<DesignStageResponse | null> => {
|
||||
try {
|
||||
const response = await API.get<DesignStageResponse>(`/pfs/${printingFileId}/`);
|
||||
return response.data;
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const addPrintingFilesFile = async (
|
||||
printingFileId: number,
|
||||
data: DesignStageFileRequest
|
||||
): Promise<DesignStageFileResponse | null> => {
|
||||
try {
|
||||
const formData = objectToFormDataConverter(data);
|
||||
const response = await API.post<DesignStageFileResponse>(`/pfs/${printingFileId}/files/`, formData);
|
||||
return response.data;
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const acceptPrintingFilesFile = async (printingFileId: number): Promise<DesignStageResponse | null> => {
|
||||
try {
|
||||
const response = await API.patch<DesignStageResponse>(`/pfs/${printingFileId}/`, { accept: true });
|
||||
return response.data;
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
const openPrintingFile = async (pringintFileId: number) => {
|
||||
try {
|
||||
const response = await API.get<AxiosResponse>(`/printing-files-files/${pringintFileId}/open-file/`);
|
||||
return response.data;
|
||||
} catch (err) {
|
||||
return null;
|
||||
}
|
||||
};
|
||||
|
||||
export default {
|
||||
openPrintingFile,
|
||||
getPrintingFileById,
|
||||
addPrintingFilesFile,
|
||||
acceptPrintingFilesFile,
|
||||
};
|
||||
// export const fetchDrafts = async (productId: number): Promise<DraftResponse[] | []> => {
|
||||
// try {
|
||||
// const response = await API.get<DraftResponse[]>('');
|
||||
// return response.data;
|
||||
// } catch (err) {
|
||||
// console.error(err);
|
||||
// return [];
|
||||
// }
|
||||
// };
|
||||
Reference in new issue
Block a user