UNPKG

@nuskin/ns-checkout

Version:

Ecomm3 Checkout module

31 lines (27 loc) 1.33 kB
import '../app.js'; import {ErrorMessageCookieService} from '@nuskin/ns-shop'; import {util, RunConfigService} from '@nuskin/ns-util'; 'use strict'; angular.module('checkout').controller('fatalErrorCtrl', ['$scope', '$window','$location', 'tdcService', function($scope, $window, $location, tdcService) { var runConfig = RunConfigService.getRunConfig(); $scope.tdc = tdcService.getTdc('checkout'); $scope.contentLoaded = false; $scope.error = ErrorMessageCookieService.getErrorMessages(); $scope.contentLoaded = true; $scope.homeLink = "/content/nuskin/" + runConfig.language + "_" + runConfig.country + "/home.html"; // When you click the home link clear errors and pass to home page $scope.clearFatalErrorGoHome = function() { $scope.error.clearErrors(); ErrorMessageCookieService.resetErrorMessagesStorage(); if (util.MobileUtils.isPhoneGap()) { window.location.href = 'index.html#/home'; } else { $window.location.href = $scope.homeLink; } }; // If you click any link and leave the fatal error page clear errors to prevent seeing elsewhere // This is in scope so it won't effect links outside of fatalError.jsp $("a:not('#fatalErrorHomeLink')").click(function() { $scope.error.clearErrors(); }); }]);