working on api.

This commit is contained in:
Quicksticks-oss committed 2024-03-21 14:00:50 -04:00
1 parent bd8bb31f9c
commit 109d901ad3
2 files changed
+9 -3

No files matched your search

+8 -2
View File
@@ -7,13 +7,19 @@ class MediaUploadManager {
async uploadMedia(blob, fileName) {
const url = `${this.baseUrl}/v1/media_uploads/upload`;
let uuid = crypto.randomUUID();
const formData = new FormData();
formData.append('uuid_idempotency_token', uuid);
formData.append('file', blob, fileName);
formData.append('source', 'file');
const response = await fetch(url, {
method: 'POST',
mode: 'cors',
mode: "cors",
credentials: "include",
headers: {
'Authorization': `Bearer ${this.sessionToken}`,
"accept": "application/json",
"content-type": "multipart/form-data"
},
body: formData,
});
+1 -1
View File
@@ -61,7 +61,7 @@ class Editor {
this.rendering = false;
// API.
this.api_manager = new MediaUploadManager("eyJhbGciOiJIUzI1NiJ9.eyJjb29raWVfdmVyc2lvbiI6IjIiLCJzZXNzaW9uX3Rva2VuIjoic2Vzc2lvbl9kaDRuazE2OHI3OWI4emNjeWJiNGNzYnEiLCJ1c2VyX3Rva2VuIjoidXNlcl9uczg3MWt5OW56OXB3In0.xwgWhGQ6oHOd6irj-CzJZkZlmCirDwM8BGnBPHbs0UE");
this.api_manager = new MediaUploadManager();
// Debug & Movement.
this.stats = null;