created assignErrorObject method to make raising an error much easier.

no error handling implemented yet.
This commit is contained in:
chris.watts90@outlook.com 2017-02-08 22:27:43 +00:00
parent 34b427293a
commit db15f01677

View File

@ -10,7 +10,7 @@
self.selectedCalendarWeek = ko.observable(0);
self.errorData = ko.observable(null);
self.apiEndpoints = {
root: "http://160.100.28.242:8800",
root: "http://localhost:8800",
getUserList: "/api/users",//"/userstest",
getUserDetails: "/api/users",//"/users",
editUser: "/api/users/edit",//"/users/edit",
@ -26,6 +26,15 @@
self.goToMenuOption = function (menu) { location.hash = menu; console.log("goToMenuOption: " + menu); };
self.goToUserDetails = function (user) { location.hash = self.uiPages.userDetails + "/" + user.UserId; };
self.goToTimeLogs = function (user) { location.hash = "timelogs" + "/" + user.UserId; };
self.assignErrorObject = function(errCode, errMessage, errorSource) {
var errDat = {
errorCode: errCode,
errorMessage: errMessage,
errorSource: errorSource,
errorDate: new Date().toDateString("yyyy-mm-dd")
};
self.errorData(errDat);
}
/**
* Create a request URL - references apiEndpoints object to construct url with args, and optional callback url.
* @param {string} routePath
@ -214,17 +223,12 @@
self.searchUsers(query);
else
self.getUserList();
var errDat = {
errorMessage: "An Error has occurred.. run away!!!",
errorSource: "test",
errorDate: new Date().toDateString("yyyy-mm-dd")
};
self.errorData(errDat);
self.assignErrorObject(101, "An Error has occurred.. run away!!!", "test");
//$.get("http://localhost:3000", { menu: this.params.menu }, self.chosenMenuData);
});
this.get("#userData/:userId", function () {
//console.log("getting details for user: " + this.params.userId);
self.chosenMenuItemId("Data"); //todo: change this! (replace with actual get timelogs call)
self.chosenMenuItemId("Data");
self.userList(null);
self.getUserDetails(this.params.userId);
self.userTimeLogData(null);