handle client secret upload

This commit is contained in:
arc-alex
2023-11-18 17:24:29 +01:00
parent 38cf3a7b63
commit 31b46bbb34
4 changed files with 33 additions and 4 deletions
+22
View File
@@ -227,3 +227,25 @@ export async function getLatestVersion(): Promise<HasUpdate> {
export async function postNew(initialData: Partial<ProjectData>) {
return axios.post(`${ontimeURL}/new`, initialData);
}
/**
* @description sheet Client File
* @return {Promise}
*/
export const uploadSheetClientFile = async (
file: File
) => {
const formData = new FormData();
formData.append('userFile', file);
await axios
.post(`${ontimeURL}/sheet-clientsecrect`, formData, {
headers: {
'Content-Type': 'multipart/form-data',
},
onUploadProgress: (progressEvent) => {
const complete = progressEvent?.total ? Math.round((progressEvent.loaded * 100) / progressEvent.total) : 0;
},
})
.then((response) => response.data.id);
};