mirror of
https://github.com/BetterSEQTA/BetterSEQTA-Plus.git
synced 2026-06-13 07:04:39 +00:00
forgot about functions, still LET'S GO (test req)
This commit is contained in:
@@ -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 => {
|
||||
|
||||
Reference in New Issue
Block a user