mirror of
https://github.com/inventree/InvenTree
synced 2024-08-30 18:33:04 +00:00
Null url fix (#7408)
* RelatedModelField fix Handle edge case where URL evaluates as null * Handle undefined field
This commit is contained in:
parent
7b179aaf95
commit
3ecbd64bf7
@ -59,12 +59,17 @@ export function RelatedModelField({
|
||||
if (field.value === pk) return;
|
||||
|
||||
if (
|
||||
field.value !== null &&
|
||||
field.value !== undefined &&
|
||||
field.value !== ''
|
||||
field?.value !== null &&
|
||||
field?.value !== undefined &&
|
||||
field?.value !== ''
|
||||
) {
|
||||
const url = `${definition.api_url}${field.value}/`;
|
||||
|
||||
if (!url) {
|
||||
setPk(null);
|
||||
return;
|
||||
}
|
||||
|
||||
api.get(url).then((response) => {
|
||||
let pk_field = definition.pk_field ?? 'pk';
|
||||
if (response.data && response.data[pk_field]) {
|
||||
|
Loading…
Reference in New Issue
Block a user