mirror of https://github.com/portainer/portainer
fix(code): remove duplicated code BE-11821 (#667)
parent
01afe34df7
commit
6fcf1893d3
|
@ -45,7 +45,7 @@ func WithItem[TId ~int, TObject any](getter ItemGetter[TId, TObject], idParam st
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func FetchItem[T any](request *http.Request, contextKey string) (*T, error) {
|
func FetchItem[T any](request *http.Request, contextKey ItemContextKey) (*T, error) {
|
||||||
contextData := request.Context().Value(contextKey)
|
contextData := request.Context().Value(contextKey)
|
||||||
if contextData == nil {
|
if contextData == nil {
|
||||||
return nil, errors.New("unable to find item in request context")
|
return nil, errors.New("unable to find item in request context")
|
||||||
|
|
Loading…
Reference in New Issue