Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

update mock response, use the right response properties

Jason Kentfa067517828e
diff --git a/web/js/containers/share.js b/web/js/containers/share.js
index 11b1d155b..e173474fc 100644
--- a/web/js/containers/share.js
+++ b/web/js/containers/share.js
@@ -20,7 +20,7 @@ import history from '../main';
const getShortenRequestString = (mock, permalink) => {
const mockStr = mock || '';
- if (/localhost/.test(window.location)) {
+ if (/localhost/.test(window.location.href)) {
return 'mock/short_link.json';
}
return (
@@ -146,13 +146,15 @@ class ShareLinkContainer extends Component {
// If a short link can be generated, replace the full link.
if (type === 'twitter') {
const newTab = window.open('', '_blank');
- this.getShortLink().then(({ data }) => {
- shareLink = getSharelink(type, data.url);
+ this.getShortLink().then(({ link }) => {
+ shareLink = getSharelink(type, link);
+ }).finally(() => {
newTab.location = shareLink;
});
} else if (type === 'email') {
- this.getShortLink().then(({ data }) => {
- shareLink = getSharelink(type, data.url);
+ this.getShortLink().then(({ link }) => {
+ shareLink = getSharelink(type, link);
+ }).finally(() => {
window.location = shareLink;
});
} else {
diff --git a/web/mock/short_link.json b/web/mock/short_link.json
index fd04bf571..1aa59d82a 100644
--- a/web/mock/short_link.json
+++ b/web/mock/short_link.json
@@ -1,7 +1,13 @@
{
- "data": {
- "url": "http://go.nasa.gov/1iKIZ4j"
- },
- "status_code": 200,
- "status_txt": "OK"
+ "created_at": "2020-08-31T17:21:41+0000",
+ "id": "go.nasa.gov/3lzPmPt",
+ "link": "https://go.nasa.gov/3lzPmPt",
+ "custom_bitlinks": [],
+ "long_url": "https://worldview.uat.earthdata.nasa.gov/?l=Reference_Labels(hidden),Reference_Features(hidden),VIIRS_NOAA20_CorrectedReflectance_TrueColor(hidden),VIIRS_SNPP_CorrectedReflectance_TrueColor,MODIS_Aqua_CorrectedReflectance_TrueColor,MODIS_Terra_CorrectedReflectance_TrueColor&t=2020-08-31-T17:05:22Z",
+ "archived": false,
+ "tags": [],
+ "deeplinks": [],
+ "references": {
+ "group": "https://api-ssl.bitly.com/v4/groups/BdcvjW6GKf1"
+ }
}
\ No newline at end of file