diff --git a/scripts/forum.controller.js b/scripts/forum.controller.js index e8cace7..d78701e 100644 --- a/scripts/forum.controller.js +++ b/scripts/forum.controller.js @@ -165,10 +165,11 @@ daddy.controller("createTopicCtrlr", function($scope, $location, $http, stateDat $scope.createPost($scope.topic.postContent, res.data.topicNo) } }).catch((res) => { + $scope.status.show = true; if (res.status == 500) { console.log("something went wrong: " + res.data) $scope.status.text = "Something went wrong: " + res.status - } else if (res.status == 403) { + } else if (res.status == 401) { console.log("something went worng: " + res.data) $scope.status.text = "Authentication failed. For saftey reasons, you have been logged out, please log in and try again." stateData.logOut() @@ -196,10 +197,11 @@ daddy.controller("createTopicCtrlr", function($scope, $location, $http, stateDat $location.path("/topics/" + topicNo) } }).catch((res) => { + $scope.status.show = true; if (res.status == 500) { console.log("something went wrong: " + res.data) $scope.status.text = "Something went wrong: " + res.status - } else if (res.status == 403) { + } else if (res.status == 401) { console.log("something went worng: " + res.data) $scope.status.text = "Authentication failed. For saftey reasons, you have been logged out, please log in and try again." stateData.logOut() @@ -271,10 +273,11 @@ daddy.controller("createCategoryCtrlr", function($scope, $http, $location, state $location.path("/categories/" + res.data.catNo) } }).catch((res) => { + $scope.status.show = true; if (res.status == 500) { console.log("something went wrong: " + res.data) $scope.status.text = "Something went wrong: " + res.status - } else if (res.status == 403) { + } else if (res.status == 401) { console.log("something went worng: " + res.data) $scope.status.text = "Authentication failed. For saftey reasons, you have been logged out, please log in and try again." stateData.logOut() @@ -360,11 +363,12 @@ daddy.controller("topicsCtrlr", function($scope, $routeParams, $timeout, $http, $timeout(function() { $scope.getTopic() }, 2000) } }).catch((res) => { + $scope.status.show = true; if (res.status == 500) { console.log("something went wrong: ") console.log(res.data) $scope.status.text = "Something went wrong: " + res.status - } else if (res.status == 403) { + } else if (res.status == 401) { console.log("something went worng: " + res.data) $scope.status.text = "Authentication failed. For saftey reasons, you have been logged out, please log in and try again." stateData.logOut() @@ -405,10 +409,11 @@ daddy.controller("topicsCtrlr", function($scope, $routeParams, $timeout, $http, } }).catch((res) => { if (res.status == 500) { + $scope.status.show = true; console.log("something went wrong: ") console.log(res.data) $scope.status.text = "Something went wrong: " + res.status - } else if (res.status == 403) { + } else if (res.status == 401) { console.log("something went worng: " + res.data) $scope.status.text = "Authentication failed. For saftey reasons, you have been logged out, please log in and try again." stateData.logOut() @@ -440,11 +445,12 @@ daddy.controller("topicsCtrlr", function($scope, $routeParams, $timeout, $http, } } }).catch((res) => { + $scope.status.show = true; if (res.status == 500) { console.log("something went wrong: ") console.log(res.data) $scope.status.text = "Something went wrong: " + res.status - } else if (res.status == 403) { + } else if (res.status == 401) { console.log("something went worng: " + res.data) $scope.status.text = "Authentication failed. For saftey reasons, you have been logged out, please log in and try again." stateData.logOut() diff --git a/views/topics.html b/views/topics.html index be218b1..24bdd0b 100644 --- a/views/topics.html +++ b/views/topics.html @@ -30,11 +30,13 @@
{{status.text}}
+{{status.text}}