fix(ui): bulk upload issues (#13413)
### What? This PR contains a couple of fixes to the bulk upload process: - Credentials not being passed when fetching, leading to auth issues - Provide a fallback to crypto.randomUUID which is only available when using HTTPS or localhost ### Why? I use [separate admin and API URLs](#12682) and work off a remote dev server using custom hostnames. These issues may not impact the happy path of using localhost, but are dealbreakers in this environment. ### Fixes # _These are issues I found myself, I fixed them rather than raising issues for somebody else to pick up, but I can create issues to link to if required._
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import type { FormState, UploadEdits } from 'payload'
|
||||
|
||||
import { v4 as uuidv4 } from 'uuid'
|
||||
|
||||
export type State = {
|
||||
activeIndex: number
|
||||
forms: {
|
||||
@@ -50,7 +52,7 @@ export function formsManagementReducer(state: State, action: Action): State {
|
||||
for (let i = 0; i < action.files.length; i++) {
|
||||
newForms[i] = {
|
||||
errorCount: 0,
|
||||
formID: crypto.randomUUID(),
|
||||
formID: crypto.randomUUID ? crypto.randomUUID() : uuidv4(),
|
||||
formState: {
|
||||
...(action.initialState || {}),
|
||||
file: {
|
||||
|
||||
Reference in New Issue
Block a user