File tree Expand file tree Collapse file tree 1 file changed +1
-25
lines changed
frontend/src/components/Upload Expand file tree Collapse file tree 1 file changed +1
-25
lines changed Original file line number Diff line number Diff line change @@ -2,30 +2,6 @@ import axios from 'axios';
2
2
3
3
import { getPresignedUrl } from '../../helpers/API' ;
4
4
5
- export const generateUUID = ( ) : string => {
6
- let d = new Date ( ) . getTime ( ) ; //Timestamp
7
- let d2 =
8
- ( typeof performance !== 'undefined' &&
9
- performance . now &&
10
- performance . now ( ) * 1000 ) ||
11
- 0 ; //Time in microseconds since page-load or 0 if unsupported
12
-
13
- return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx' . replace ( / [ x y ] / g, ( c ) => {
14
- let r = Math . random ( ) * 16 ; //random number between 0 and 16
15
- if ( d > 0 ) {
16
- //Use timestamp until depleted
17
- r = ( ( d + r ) % 16 ) | 0 ;
18
- d = Math . floor ( d / 16 ) ;
19
- } else {
20
- //Use microseconds since page-load if supported
21
- r = ( ( d2 + r ) % 16 ) | 0 ;
22
- d2 = Math . floor ( d2 / 16 ) ;
23
- }
24
-
25
- return ( c === 'x' ? r : ( r & 0x3 ) | 0x8 ) . toString ( 16 ) ;
26
- } ) ;
27
- } ;
28
-
29
5
export type FileWithUrl = {
30
6
id : string ;
31
7
url ?: string ;
@@ -52,7 +28,7 @@ export const generateUploadUrls = async (
52
28
status : 'ready' ,
53
29
} ) ;
54
30
} else {
55
- const localUUID = generateUUID ( ) ;
31
+ const localUUID = self . crypto . randomUUID ( ) ;
56
32
newFileUploadData . set ( localUUID , {
57
33
id : localUUID ,
58
34
file : acceptedFiles [ idx ] ,
You can’t perform that action at this time.
0 commit comments