Make navigation API more robust.

Fixes https://github.com/foodcoops/foodsoft/issues/755.
This commit is contained in:
wvengen 2020-10-07 14:35:38 +02:00
parent 912f57ba42
commit 78c4ebcb4b

View file

@ -15,7 +15,7 @@ class Api::V1::NavigationsController < Api::V1::BaseController
items.map do |item| items.map do |item|
r = {} r = {}
r[:name] = item[:name] r[:name] = item[:name]
r[:url] = request.base_url + item[:url] if item[:url] != '#' r[:url] = request.base_url + item[:url] if item[:url] && item[:url] != '#'
r[:items] = transform(item[:items]) if item[:items] r[:items] = transform(item[:items]) if item[:items]
r r
end end