diff --git a/src/main/java/edu/byu/cs/controller/AdminController.java b/src/main/java/edu/byu/cs/controller/AdminController.java index 43507e84..6add0432 100755 --- a/src/main/java/edu/byu/cs/controller/AdminController.java +++ b/src/main/java/edu/byu/cs/controller/AdminController.java @@ -45,57 +45,6 @@ public class AdminController { }; - public static final Route userPatch = (req, res) -> { - String netId = req.params(":netId"); - - UserDao userDao = DaoService.getUserDao(); - User user; - try { - user = userDao.getUser(netId); - } catch (DataAccessException e) { - LOGGER.error("Error getting user", e); - halt(500); - return null; - } - - if (user == null) { - halt(404, "user not found"); - return null; - } - - try { - String firstName = req.queryParams("firstName"); - if (firstName != null) - userDao.setFirstName(user.netId(), firstName); - - String lastName = req.queryParams("lastName"); - if (lastName != null) - userDao.setLastName(user.netId(), lastName); - - String repoUrl = req.queryParams("repoUrl"); - if (repoUrl != null) - userDao.setRepoUrl(user.netId(), repoUrl); - - String role = req.queryParams("role"); - if (role != null) { - try { - userDao.setRole(user.netId(), User.Role.valueOf(role.toUpperCase())); - } catch (IllegalArgumentException e) { - halt(400, "invalid role. must be one of: STUDENT, ADMIN"); - return null; - } - } - } catch (DataAccessException e) { - LOGGER.error("Error updating user", e); - halt(500); - return null; - } - - res.status(204); - - return ""; - }; - public static final Route testModeGet = (req, res) -> { User latestTestStudent; try { diff --git a/src/main/java/edu/byu/cs/server/Server.java b/src/main/java/edu/byu/cs/server/Server.java index 18da1260..1b4585ee 100644 --- a/src/main/java/edu/byu/cs/server/Server.java +++ b/src/main/java/edu/byu/cs/server/Server.java @@ -82,8 +82,6 @@ public static int setupEndpoints(int port) { get("/users", usersGet); - patch("/user/:netId", userPatch); - post("/submit", adminRepoSubmitPost); path("/submissions", () -> { diff --git a/src/main/resources/frontend/src/App.vue b/src/main/resources/frontend/src/App.vue index 65e6aef4..a4c0594b 100644 --- a/src/main/resources/frontend/src/App.vue +++ b/src/main/resources/frontend/src/App.vue @@ -11,6 +11,7 @@ import BannerMessage from '@/components/BannerMessage.vue' import PopUp from '@/components/PopUp.vue' import RepoEditor from '@/components/RepoEditor.vue' import AboutPage from '@/components/AboutPage.vue' +import { ServerError } from '@/network/ServerError' const greeting = computed(() => { if (useAuthStore().isLoggedIn) { @@ -23,9 +24,13 @@ const logOut = async () => { await logoutPost() useAuthStore().user = null } catch (e) { - alert(e) + if (e instanceof ServerError){ + alert(e.message) + } else { + alert(e) + } } - router.push({name: "login"}) + await router.push({ name: "login" }) } onMounted( async () => { diff --git a/src/main/resources/frontend/src/components/BannerMessage.vue b/src/main/resources/frontend/src/components/BannerMessage.vue index 2a8afb81..edaf106f 100644 --- a/src/main/resources/frontend/src/components/BannerMessage.vue +++ b/src/main/resources/frontend/src/components/BannerMessage.vue @@ -1,5 +1,5 @@