Skip to content

Commit

Permalink
Renaming var flash to flashData
Browse files Browse the repository at this point in the history
  • Loading branch information
Abdulwahaab710 committed May 8, 2019
1 parent 32af7ac commit a246d8a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
10 changes: 5 additions & 5 deletions example/app/assets/javascripts/flash_messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ var eventName = typeof(Turbolinks) !== 'undefined' ? 'turbolinks:load' : 'DOMCon

if (!document.documentElement.hasAttribute("data-turbolinks-preview")) {
document.addEventListener(eventName, function flash() {
var flash = JSON.parse(document.getElementById('shopify-app-flash').dataset.flash);
var flashData = JSON.parse(document.getElementById('shopify-app-flash').dataset.flash);

if (flash.notice) {
ShopifyApp.flashNotice(flash.notice);
if (flashData.notice) {
ShopifyApp.flashNotice(flashData.notice);
}

if (flash.error) {
ShopifyApp.flashError(flash.error);
if (flashData.error) {
ShopifyApp.flashError(flashData.error);
}

document.removeEventListener(eventName, flash)
Expand Down
10 changes: 5 additions & 5 deletions lib/generators/shopify_app/install/templates/flash_messages.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ var eventName = typeof(Turbolinks) !== 'undefined' ? 'turbolinks:load' : 'DOMCon

if (!document.documentElement.hasAttribute("data-turbolinks-preview")) {
document.addEventListener(eventName, function flash() {
var flash = JSON.parse(document.getElementById('shopify-app-flash').dataset.flash);
var flashData = JSON.parse(document.getElementById('shopify-app-flash').dataset.flash);

if (flash.notice) {
ShopifyApp.flashNotice(flash.notice);
if (flashData.notice) {
ShopifyApp.flashNotice(flashData.notice);
}

if (flash.error) {
ShopifyApp.flashError(flash.error);
if (flashData.error) {
ShopifyApp.flashError(flashData.error);
}

document.removeEventListener(eventName, flash)
Expand Down

0 comments on commit a246d8a

Please sign in to comment.