diff --git a/src/middleware/fixImageUrlsMiddleware.js b/src/middleware/fixImageUrlsMiddleware.js index 864726a54..919a46ab6 100644 --- a/src/middleware/fixImageUrlsMiddleware.js +++ b/src/middleware/fixImageUrlsMiddleware.js @@ -1,9 +1,14 @@ +const urlSearchAlpha = 'https://api-alpha.human-connection.org' +const urlSearchLocal = 'http://localhost:3000' + export const fixUrl = (url) => { - return url.replace('https://api-alpha.human-connection.org', 'http://localhost:3000') + url = url.replace(urlSearchAlpha, '') + url = url.replace(urlSearchLocal, '') + return url } const fixImageURLs = (result, recursive) => { - if (result && typeof result === 'string' && result.indexOf('https://api-alpha.human-connection.org') === 0) { + if (result && typeof result === 'string' && (result.indexOf(urlSearchAlpha) === 0 || result.indexOf(urlSearchLocal) === 0)) { result = fixUrl(result) } else if (result && Array.isArray(result)) { result.forEach((res, index) => { diff --git a/src/seed/data/badges.js b/src/seed/data/badges.js index d4144d30e..bb3ad06c7 100644 --- a/src/seed/data/badges.js +++ b/src/seed/data/badges.js @@ -1,12 +1,12 @@ export default function (data) { return ` mutation { - b1: CreateBadge(id: "b1", key: "indiegogo_en_racoon", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_racoon.svg") { id } - b2: CreateBadge(id: "b2", key: "indiegogo_en_rabbit", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_rabbit.svg") { id } - b3: CreateBadge(id: "b3", key: "indiegogo_en_wolf", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_wolf.svg") { id } - b4: CreateBadge(id: "b4", key: "indiegogo_en_bear", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_bear.svg") { id } - b5: CreateBadge(id: "b5", key: "indiegogo_en_turtle", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_turtle.svg") { id } - b6: CreateBadge(id: "b6", key: "indiegogo_en_rhino", type: crowdfunding, status: permanent, icon: "http://localhost:3000/img/badges/indiegogo_en_rhino.svg") { id } + b1: CreateBadge(id: "b1", key: "indiegogo_en_racoon", type: crowdfunding, status: permanent, icon: "/img/badges/indiegogo_en_racoon.svg") { id } + b2: CreateBadge(id: "b2", key: "indiegogo_en_rabbit", type: crowdfunding, status: permanent, icon: "/img/badges/indiegogo_en_rabbit.svg") { id } + b3: CreateBadge(id: "b3", key: "indiegogo_en_wolf", type: crowdfunding, status: permanent, icon: "/img/badges/indiegogo_en_wolf.svg") { id } + b4: CreateBadge(id: "b4", key: "indiegogo_en_bear", type: crowdfunding, status: permanent, icon: "/img/badges/indiegogo_en_bear.svg") { id } + b5: CreateBadge(id: "b5", key: "indiegogo_en_turtle", type: crowdfunding, status: permanent, icon: "/img/badges/indiegogo_en_turtle.svg") { id } + b6: CreateBadge(id: "b6", key: "indiegogo_en_rhino", type: crowdfunding, status: permanent, icon: "/img/badges/indiegogo_en_rhino.svg") { id } } ` } diff --git a/src/seed/data/users-badges.js b/src/seed/data/users-badges.js index e303c6157..1a8bc1fe1 100644 --- a/src/seed/data/users-badges.js +++ b/src/seed/data/users-badges.js @@ -1,7 +1,12 @@ export default function (data) { return ` mutation { - u1_blacklist_u4: AddUserBlacklisted(from: { id: "u1" }, to: { id: "u4" }) { from { id } } + b1_u1: AddUserBadges(from: {id: "b1"}, to: {id: "u1"}) { from { id } } + b2_u1: AddUserBadges(from: {id: "b2"}, to: {id: "u1"}) { from { id } } + b3_u1: AddUserBadges(from: {id: "b3"}, to: {id: "u1"}) { from { id } } + b6_u2: AddUserBadges(from: {id: "b6"}, to: {id: "u2"}) { from { id } } + b3_u3: AddUserBadges(from: {id: "b3"}, to: {id: "u3"}) { from { id } } + b5_u4: AddUserBadges(from: {id: "b5"}, to: {id: "u4"}) { from { id } } } ` } diff --git a/src/seed/data/users-blacklist.js b/src/seed/data/users-blacklist.js index 1a8bc1fe1..e303c6157 100644 --- a/src/seed/data/users-blacklist.js +++ b/src/seed/data/users-blacklist.js @@ -1,12 +1,7 @@ export default function (data) { return ` mutation { - b1_u1: AddUserBadges(from: {id: "b1"}, to: {id: "u1"}) { from { id } } - b2_u1: AddUserBadges(from: {id: "b2"}, to: {id: "u1"}) { from { id } } - b3_u1: AddUserBadges(from: {id: "b3"}, to: {id: "u1"}) { from { id } } - b6_u2: AddUserBadges(from: {id: "b6"}, to: {id: "u2"}) { from { id } } - b3_u3: AddUserBadges(from: {id: "b3"}, to: {id: "u3"}) { from { id } } - b5_u4: AddUserBadges(from: {id: "b5"}, to: {id: "u4"}) { from { id } } + u1_blacklist_u4: AddUserBlacklisted(from: { id: "u1" }, to: { id: "u4" }) { from { id } } } ` }