Hi,
I am trying to display a view upon the login authentication post the button click .
Login.controller.js
sap.ui.define([
"sap/ui/core/mvc/Controller",
"sap/m/MessageToast",
"sap/ui/model/json/JSONModel"
], function (Controller, MessageToast, JSONModel) {
"use strict";
return Controller.extend("n_cloudonvoice.controller.Login", {
actLogin: function () {
var oRouter = sap.ui.core.UIComponent.getRouterFor(this); ///////////////// Router navigation Work well Here which I dont want /////////////
oRouter.navTo("Campaign");
var sURL = "/destinations/cloudonvoice?method=checkLoginForSap&user=" + this.byId("inpLogin").getValue() +
"&pass=" + this.byId("inpPWD").getValue(); // compile URL to call
var oModel = new sap.ui.model.json.JSONModel();
oModel.loadData(sURL,"",true);
oModel.attachRequestCompleted(function() {
var name = oModel.getProperty("/User/0/name");
MessageToast.show("Welcome "+name +" !!! ");
var oStorage = jQuery.sap.storage(jQuery.sap.storage.Type.local);
oStorage.put("cloudonvoice_authdata", oModel);
var oRouter = sap.ui.core.UIComponent.getRouterFor(this); ///////////////// Router navigation doesnt Work Here which I want /////////////
oRouter.navTo("Campaign");
});
}
});
});
If someone can guide me where I am going wrong .
Plz suggest.
Rg