forgot about functions, still LET'S GO (test req)

This commit is contained in:
Crazypersonalph
2023-12-04 20:39:13 +08:00
parent aaca124ff0
commit 8af59e58d6
11 changed files with 67 additions and 58 deletions
+4 -4
View File
@@ -5,7 +5,7 @@
* @returns {Promise} A promise that resolves to the response from the server.
* @throws {Error} If no file is provided or if there is an error during upload.
*/
export async function UploadImage(file) {
export async function UploadImage(file: any) {
// Ensuring that file is provided
if (!file) {
throw new Error("No file provided");
@@ -28,12 +28,12 @@ export async function UploadImage(file) {
};
// Making the fetch request and returning the promise
return fetch('/seqta/student/file/upload/xhr2', requestOptions)
.then(response => {
return await fetch('/seqta/student/file/upload/xhr2', requestOptions)
.then(async response => {
if (!response.ok) {
throw new Error(`HTTP error! Status: ${response.status}`);
}
const json = response.json();
const json = await response.json();
return `/seqta/student/load/file?type=message&file=${json.uuid}`;
})
.catch(error => {