Skip to content

Commit c686a2b

Browse files
committed
refactor(Url.asMap): simplify code.
Addressed to #927 No functional changes.
1 parent b8eab5d commit c686a2b

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/main/java/ru/mystamps/web/Url.java

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,7 @@ private Url() {
4949
}
5050

5151
public static Map<String, String> asMap(boolean production) {
52-
boolean serveContentFromSingleHost = !production;
53-
54-
// Not all URLs are listed here but only those that are being used on views
52+
// Not all URLs are exported here but only those that are being used on views
5553
Map<String, String> map = new HashMap<>();
5654
AccountUrl.exposeUrlsToView(map);
5755
CategoryUrl.exposeUrlsToView(map);
@@ -69,13 +67,9 @@ public static Map<String, String> asMap(boolean production) {
6967

7068
map.put("PUBLIC_URL", production ? SiteUrl.PUBLIC_URL : SiteUrl.SITE);
7169

72-
if (serveContentFromSingleHost) {
73-
ImageUrl.exposeResourcesToView(map, null);
74-
ResourceUrl.exposeResourcesToView(map, null);
75-
} else {
76-
ImageUrl.exposeResourcesToView(map, ResourceUrl.STATIC_RESOURCES_URL);
77-
ResourceUrl.exposeResourcesToView(map, ResourceUrl.STATIC_RESOURCES_URL);
78-
}
70+
String resourcesHost = production ? ResourceUrl.STATIC_RESOURCES_URL : null;
71+
ImageUrl.exposeResourcesToView(map, resourcesHost);
72+
ResourceUrl.exposeResourcesToView(map, resourcesHost);
7973

8074
return map;
8175
}

0 commit comments

Comments
 (0)