mirror of
				https://github.com/inventree/InvenTree.git
				synced 2025-10-30 20:55:42 +00:00 
			
		
		
		
	| @@ -34,7 +34,8 @@ export function constructFormUrl( | ||||
|  */ | ||||
| export function extractAvailableFields( | ||||
|   response: AxiosResponse, | ||||
|   method?: string | ||||
|   method?: string, | ||||
|   hideErrors?: boolean | ||||
| ): Record<string, ApiFormFieldType> | null { | ||||
|   // OPTIONS request *must* return 200 status | ||||
|   if (response.status !== 200) { | ||||
| @@ -44,21 +45,7 @@ export function extractAvailableFields( | ||||
|  | ||||
|   let actions: any = response.data?.actions ?? null; | ||||
|  | ||||
|   if (!method) { | ||||
|     notifications.show({ | ||||
|       title: t`Form Error`, | ||||
|       message: t`Form method not provided`, | ||||
|       color: 'red' | ||||
|     }); | ||||
|     return null; | ||||
|   } | ||||
|  | ||||
|   if (!actions) { | ||||
|     notifications.show({ | ||||
|       title: t`Form Error`, | ||||
|       message: t`Response did not contain action data`, | ||||
|       color: 'red' | ||||
|     }); | ||||
|   if (!method || !actions) { | ||||
|     return null; | ||||
|   } | ||||
|  | ||||
| @@ -71,7 +58,9 @@ export function extractAvailableFields( | ||||
|  | ||||
|   if (!(method in actions)) { | ||||
|     // Missing method - this means user does not have appropriate permission | ||||
|     if (!hideErrors) { | ||||
|       permissionDenied(); | ||||
|     } | ||||
|     return null; | ||||
|   } | ||||
|  | ||||
|   | ||||
| @@ -145,7 +145,7 @@ export function InvenTreeTable<T = any>({ | ||||
|  | ||||
|             let names: Record<string, string> = {}; | ||||
|             let fields: ApiFormFieldSet = | ||||
|               extractAvailableFields(response, 'POST') || {}; | ||||
|               extractAvailableFields(response, 'POST', true) || {}; | ||||
|  | ||||
|             // Extract flattened map of fields | ||||
|             mapFields(fields, (path, field) => { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user