mirror of
https://github.com/Steffo99/sophon.git
synced 2024-12-21 22:34:21 +00:00
🔧 Display not found errors for not available resource keys
This commit is contained in:
parent
85d251f799
commit
ad1f12393c
1 changed files with 9 additions and 1 deletions
|
@ -50,7 +50,15 @@ export function ViewSetRouter<Resource extends DjangoResource>({viewSet, unselec
|
|||
)
|
||||
}
|
||||
|
||||
const selection = pk ? viewSet.resources?.find(res => res.value[pkKey] === pk) : undefined
|
||||
let selection
|
||||
if(pk) {
|
||||
selection = viewSet.resources?.find(res => res.value[pkKey] === pk)
|
||||
if(!selection) {
|
||||
return (
|
||||
<ErrorBox error={new Error(`Resource not found: ${pk}`)}/>
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
return (
|
||||
<ResourceRouter
|
||||
|
|
Loading…
Reference in a new issue