-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added everything for Step 16: Handle Invalid Hashes by Listening to B…
…ypassed Events
- Loading branch information
Showing
1 changed file
with
23 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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."); | ||
}); | ||
} | ||
}); | ||
}); |