diff --git a/control/content/app.js b/control/content/app.js index 1fb6420..bd16f9f 100644 --- a/control/content/app.js +++ b/control/content/app.js @@ -19,7 +19,7 @@ ContentHome.init = function () { ContentHome.success = function (result) { console.info('init success result:', result); - if (result) { + if (result.data && result.id) { ContentHome.data = result.data; if (!ContentHome.data.content) ContentHome.data.content = {}; @@ -30,6 +30,11 @@ } ContentHome.googleSheetUrl = ContentHome.data.content.url; } + else { + var dummyData = {url: "https://docs.google.com/spreadsheets/d/1DRVGSGJh5s1w2giLbizZW6t6OT1Ea-YIewzX9D4meJ4/pubhtml#gid=0"}; + ContentHome.googleSheetUrl = ContentHome.data.content.url = dummyData.url; + ContentHome.mode = ContentHome.modeType.PREVIEW; + } }; ContentHome.error = function (err) { if (err && err.code !== STATUS_CODE.NOT_FOUND) { diff --git a/widget/app.js b/widget/app.js index c91de6c..6d8e84b 100644 --- a/widget/app.js +++ b/widget/app.js @@ -11,17 +11,28 @@ */ WidgetHome.init = function () { WidgetHome.success = function (result) { + if (result.data && result.id) { WidgetHome.data = result.data; - if(WidgetHome.data && WidgetHome.data.content && WidgetHome.data.content.url) { - if (WidgetHome.data.content.mode == 'EDITABLE') - WidgetHome.data.content.url = WidgetHome.data.content.url.replace("/htmlview", "/edit"); - else - WidgetHome.data.content.url = WidgetHome.data.content.url.replace("/edit", "/htmlview"); - } - if (!WidgetHome.data.content) + if (WidgetHome.data && WidgetHome.data.content && WidgetHome.data.content.url) { + if (WidgetHome.data.content.mode == 'EDITABLE') + WidgetHome.data.content.url = WidgetHome.data.content.url.replace("/htmlview", "/edit"); + else + WidgetHome.data.content.url = WidgetHome.data.content.url.replace("/edit", "/htmlview"); + } + if (!WidgetHome.data.content) WidgetHome.data.content = {}; console.log(">>>>>", WidgetHome.data); } + + else + { + WidgetHome.data = { + content: {} + }; + var dummyData = {url: "https://docs.google.com/spreadsheets/d/1DRVGSGJh5s1w2giLbizZW6t6OT1Ea-YIewzX9D4meJ4/pubhtml#gid=0"}; + WidgetHome.data.content.url = dummyData.url; + } + } WidgetHome.error = function (err) { if (err && err.code !== STATUS_CODE.NOT_FOUND) { console.error('Error while getting data', err);