Skip to content

Commit

Permalink
Added everything for Step 16: Handle Invalid Hashes by Listening to B…
Browse files Browse the repository at this point in the history
…ypassed Events
  • Loading branch information
wridgeu committed Apr 9, 2020
1 parent 304afbd commit 08791dc
Showing 1 changed file with 23 additions and 4 deletions.
27 changes: 23 additions & 4 deletions webapp/controller/App.controller.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,26 @@
sap.ui.define([
"com/mrb/UI5-Navigation-and-Routing/controller/BaseController"
], function(BaseController) {
"use strict";
"com/mrb/UI5-Navigation-and-Routing/controller/BaseController",
"sap/base/Log"
], function (BaseController, Log) {
"use strict";

return BaseController.extend("com.mrb.UI5-Navigation-and-Routing.controller.App", {});
return BaseController.extend("com.mrb.UI5-Navigation-and-Routing.controller.App", {
onInit: function () {
// This is ONLY for being used within the tutorial.
// The default log level of the current running environment may be higher than INFO,
// in order to see the debug info in the console, the log level needs to be explicitly
// set to INFO here.
// But for application development, the log level doesn't need to be set again in the code.
Log.setLevel(Log.Level.INFO);

var oRouter = this.getRouter();

oRouter.attachBypassed(function (oEvent) {
var sHash = oEvent.getParameter("hash");
// do something here, i.e. send logging data to the backend for analysis
// telling what resource the user tried to access...
Log.info("Sorry, but the hash '" + sHash + "' is invalid.", "The resource was not found.");
});
}
});
});

0 comments on commit 08791dc

Please sign in to comment.