diff --git a/src/Components/Profile/OverlayItemProfileSettings.tsx b/src/Components/Profile/OverlayItemProfileSettings.tsx index 858cdb36..a00a0951 100644 --- a/src/Components/Profile/OverlayItemProfileSettings.tsx +++ b/src/Components/Profile/OverlayItemProfileSettings.tsx @@ -105,11 +105,11 @@ export function OverlayItemProfileSettings() { setNeeds([]); setRelations([]); item?.offers?.map(o => { - const offer = tags.find(t => t.id === o.tags_id); + const offer = tags?.find(t => t.id === o.tags_id); offer && setOffers(current => [...current, offer]) }) item?.needs?.map(o => { - const need = tags.find(t => t.id === o.tags_id); + const need = tags?.find(t => t.id === o.tags_id); need && setNeeds(current => [...current, need]) }) item.relations?.map(r => { @@ -133,7 +133,7 @@ export function OverlayItemProfileSettings() { let offer_updates: Array = []; //check for new offers - offers.map(o => { + offers?.map(o => { const existingOffer = item?.offers?.find(t => t.tags_id === o.id) existingOffer && offer_updates.push(existingOffer.id) if (!existingOffer && !tags.some(t => t.id === o.id)) addTag({ ...o, offer_or_need: true }) @@ -142,7 +142,7 @@ export function OverlayItemProfileSettings() { let needs_updates: Array = []; - needs.map(n => { + needs?.map(n => { const existingNeed = user?.needs.find(t => t.tags_id === n.id) existingNeed && needs_updates.push(existingNeed.id) !existingNeed && needs_updates.push({ items_id: item?.id, tags_id: n.id }) diff --git a/src/SampleData/data.js b/src/SampleData/data.js deleted file mode 100644 index 36c6bf5c..00000000 --- a/src/SampleData/data.js +++ /dev/null @@ -1,33 +0,0 @@ -export const places = [{ - "id": 51, - "name": "Stadtgemüse", - "text": "Stadtgemüse Fulda ist eine Gemüsegärtnerei in Maberzell, die es sich zur Aufgabe gemacht hat, die Stadt und seine Bewohner:innen mit regionalem, frischem und natürlich angebautem Gemüse mittels Gemüsekisten zu versorgen. Es gibt also jede Woche, von Frühjahr bis Herbst, angepasst an die Saison eine Kiste mit schmackhaftem und frischem Gemüse für euch, welche ihr direkt vor Ort abholen könnt. \r\n\r\nhttps://stadtgemuese-fulda.de", - "position": { "type": "Point", "coordinates": [9.632435, 50.560342] }, - "tags": [9,13], - }, - { - "id": 166, - "name": "Weidendom", - "text": "free camping", - "position": { "type": "Point", "coordinates": [9.438793, 50.560112] }, - "tags": [10,11] - }]; - - export const events = [ - { - "id": 423, - "name": "Hackathon", - "text": "still in progress", - "position": { "type": "Point", "coordinates": [9.5, 50.62] }, - "start": "2022-03-25T12:00:00", - "end": "2022-05-12T12:00:00", - "tags": [10] - } - ] - - export const tags = [ - { "id": "Gardening", "color": "#008e5b" }, - { "id": "Art", "color": "#fdc60b" }, - { "id": "Nature", "color": "#8cbb26" }, - { "id": "Market", "color": "#2a71b0" } - ] \ No newline at end of file