@amityco/ts-sdk-react-native 6.28.1 → 6.28.2-9ac11c6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amityco/ts-sdk-react-native",
3
- "version": "6.28.1",
3
+ "version": "6.28.2-9ac11c6.0",
4
4
  "license": "CC-BY-ND-4.0",
5
5
  "author": "amity.co <developers@amity.co> (https://amity.co)",
6
6
  "description": "Amity Social Cloud Typescript SDK",
@@ -33,19 +33,21 @@ export const uploadImage = async (
33
33
 
34
34
  if (!files.length) throw new Error('The formData object must have a `files` key.');
35
35
 
36
+ const newFormDataWithMimeType = rebuildFormDataWithMimeType(formData);
37
+
36
38
  const accessType = GlobalFileAccessType.getInstance().getFileAccessType();
37
- formData.append('accessType', accessType);
39
+ newFormDataWithMimeType.append('accessType', accessType);
38
40
 
39
- formData.append('preferredFilename', (files[0] as File).name);
41
+ newFormDataWithMimeType.append('preferredFilename', (files[0] as File).name);
40
42
 
41
43
  const headers =
42
- 'getHeaders' in formData
43
- ? (formData as any).getHeaders()
44
+ 'getHeaders' in newFormDataWithMimeType
45
+ ? (newFormDataWithMimeType as any).getHeaders()
44
46
  : { 'content-type': 'multipart/form-data' };
45
47
 
46
48
  const { data } = await client.http.post<Amity.CreateFilePayload<'image'>>(
47
49
  '/api/v4/images',
48
- rebuildFormDataWithMimeType(formData),
50
+ newFormDataWithMimeType,
49
51
  {
50
52
  headers,
51
53
  onUploadProgress({ loaded, total = 100 }) {
@@ -35,23 +35,25 @@ export const uploadVideo = async (
35
35
 
36
36
  if (!files.length) throw new Error('The formData object must have a `files` key.');
37
37
 
38
+ const newFormDataWithMimeType = rebuildFormDataWithMimeType(formData);
39
+
38
40
  const accessType = GlobalFileAccessType.getInstance().getFileAccessType();
39
- formData.append('accessType', accessType);
41
+ newFormDataWithMimeType.append('accessType', accessType);
40
42
 
41
- formData.append('preferredFilename', (files[0] as File).name);
43
+ newFormDataWithMimeType.append('preferredFilename', (files[0] as File).name);
42
44
 
43
45
  if (feedType) {
44
- formData.append('feedType', feedType);
46
+ newFormDataWithMimeType.append('feedType', feedType);
45
47
  }
46
48
 
47
49
  const headers =
48
- 'getHeaders' in formData
49
- ? (formData as any).getHeaders()
50
+ 'getHeaders' in newFormDataWithMimeType
51
+ ? (newFormDataWithMimeType as any).getHeaders()
50
52
  : { 'content-type': 'multipart/form-data' };
51
53
 
52
54
  const { data } = await client.http.post<Amity.CreateFilePayload<'video'>>(
53
55
  '/api/v4/videos',
54
- rebuildFormDataWithMimeType(formData),
56
+ newFormDataWithMimeType,
55
57
  {
56
58
  headers,
57
59
  onUploadProgress({ loaded, total = 100 }) {
@@ -59,7 +61,6 @@ export const uploadVideo = async (
59
61
  },
60
62
  },
61
63
  );
62
-
63
64
  // API-FIX: payload should be serialized properly
64
65
  // const { files } = data
65
66