mirror of
				https://github.com/inventree/inventree-app.git
				synced 2025-10-31 13:25:40 +00:00 
			
		
		
		
	Display HTTP error codes on form errors
This commit is contained in:
		| @@ -885,7 +885,7 @@ class _APIFormWidgetState extends State<APIFormWidget> { | ||||
|       case 400: | ||||
|         // Form submission / validation error | ||||
|         showSnackIcon( | ||||
|           L10().error, | ||||
|           L10().formError, | ||||
|           success: false | ||||
|         ); | ||||
|  | ||||
| @@ -894,13 +894,42 @@ class _APIFormWidgetState extends State<APIFormWidget> { | ||||
|           field.data["errors"] = response.data[field.name]; | ||||
|         } | ||||
|         break; | ||||
|       case 405: | ||||
|       case 401: | ||||
|         showSnackIcon( | ||||
|           L10().response405, | ||||
|           "401: " + L10().response401, | ||||
|           success: false | ||||
|         ); | ||||
|         break; | ||||
|       case 403: | ||||
|         showSnackIcon( | ||||
|           "403: " + L10().response403, | ||||
|           success: false, | ||||
|         ); | ||||
|         break; | ||||
|       case 404: | ||||
|         showSnackIcon( | ||||
|           "404: " + L10().response404, | ||||
|           success: false, | ||||
|         ); | ||||
|         break; | ||||
|       case 405: | ||||
|         showSnackIcon( | ||||
|           "405: " + L10().response405, | ||||
|           success: false, | ||||
|         ); | ||||
|         break; | ||||
|       case 500: | ||||
|         showSnackIcon( | ||||
|           "500: " + L10().response500, | ||||
|           success: false, | ||||
|         ); | ||||
|         break; | ||||
|       default: | ||||
|         showSnackIcon( | ||||
|           "${response.statusCode}: " + L10().responseInvalid, | ||||
|           success: false, | ||||
|         ); | ||||
|         break; | ||||
|       // TODO: Other status codes? | ||||
|     } | ||||
|  | ||||
|     setState(() { | ||||
|   | ||||
							
								
								
									
										2
									
								
								lib/l10n
									
									
									
									
									
								
							
							
								
								
								
								
								
							
						
						
									
										2
									
								
								lib/l10n
									
									
									
									
									
								
							 Submodule lib/l10n updated: bdaf7a516c...ef5ca26eff
									
								
							
		Reference in New Issue
	
	Block a user