Fixed some bugs

This commit is contained in:
Martin Asprusten 2026-04-16 21:09:46 +02:00
parent 3b265735ec
commit 190625e9d8
No known key found for this signature in database
2 changed files with 14 additions and 14 deletions

View File

@ -33,7 +33,7 @@ interface AlpineState {
removeAdministrator: (userId: number) => void, removeAdministrator: (userId: number) => void,
deleteUser: (userId: number) => void, deleteUser: (userId: number) => void,
onClickHideCheckbox: (event: Event) => void, onClickHideCheckbox: (event: PointerEvent) => void,
init: () => void, init: () => void,
setServerMessage: (newMessage: Sykkelaksjon) => void, setServerMessage: (newMessage: Sykkelaksjon) => void,

View File

@ -74,7 +74,7 @@ public class Server {
return activityMessage; return activityMessage;
} }
@CrossOrigin(origins = {"http://localhost:5173"}, allowCredentials = "true") @CrossOrigin
@GetMapping("/api") @GetMapping("/api")
public ServerMessageSchema respondToRequest() throws ServerExceptionHandler.InvalidUserException { public ServerMessageSchema respondToRequest() throws ServerExceptionHandler.InvalidUserException {
var optionalUserProfile = profileManager.getProfile(); var optionalUserProfile = profileManager.getProfile();
@ -188,7 +188,7 @@ public class Server {
return serverMessage; return serverMessage;
} }
@CrossOrigin(origins = {"http://localhost:5173"}, allowCredentials = "true") @CrossOrigin
@PostMapping(path = "/api/submitActivity", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PostMapping(path = "/api/submitActivity", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void submitActivity( public void submitActivity(
@RequestParam("activity-type") Long activityTypeId, @RequestParam("activity-type") Long activityTypeId,
@ -213,7 +213,7 @@ public class Server {
}); });
} }
@CrossOrigin(origins = {"http://localhost:5173"}, allowCredentials = "true") @CrossOrigin
@PostMapping(path = "/api/submitActivityTemplate", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PostMapping(path = "/api/submitActivityTemplate", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void submitActivityTemplate( public void submitActivityTemplate(
@RequestParam("activity-type") Long activityTypeId, @RequestParam("activity-type") Long activityTypeId,
@ -238,7 +238,7 @@ public class Server {
}); });
} }
@CrossOrigin(origins = {"http://localhost:5173"}, allowCredentials = "true") @CrossOrigin
@DeleteMapping(path = "/api/deleteActivityTemplate", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @DeleteMapping(path = "/api/deleteActivityTemplate", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void deleteActivityTemplate(@RequestParam("activity-template-id") Long activityTemplateId) { public void deleteActivityTemplate(@RequestParam("activity-template-id") Long activityTemplateId) {
profileManager.getProfile().ifPresent(userProfile -> { profileManager.getProfile().ifPresent(userProfile -> {
@ -253,7 +253,7 @@ public class Server {
}); });
} }
@CrossOrigin(origins = {"http://localhost:5173"}, allowCredentials = "true") @CrossOrigin
@DeleteMapping(path = "/api/deleteActivity", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @DeleteMapping(path = "/api/deleteActivity", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void deleteActivity(@RequestParam("activity-id") Long activityId) { public void deleteActivity(@RequestParam("activity-id") Long activityId) {
profileManager.getProfile().ifPresent(userProfile -> { profileManager.getProfile().ifPresent(userProfile -> {
@ -268,7 +268,7 @@ public class Server {
}); });
} }
@CrossOrigin(origins = {"http://localhost:5173"}, allowCredentials = "true") @CrossOrigin
@PostMapping(path = "/api/addActivityType", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PostMapping(path = "/api/addActivityType", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void createActivityType( public void createActivityType(
@RequestParam("activity-type-name") String name, @RequestParam("activity-type-name") String name,
@ -288,7 +288,7 @@ public class Server {
}); });
} }
@CrossOrigin(origins = {"http://localhost:5173"}, allowCredentials = "true") @CrossOrigin
@DeleteMapping(path = "/api/deleteActivityType", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @DeleteMapping(path = "/api/deleteActivityType", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void deleteActivityType(@RequestParam("activity-type-id") Long activityTypeId) { public void deleteActivityType(@RequestParam("activity-type-id") Long activityTypeId) {
profileManager.getProfile().ifPresent(userProfile -> { profileManager.getProfile().ifPresent(userProfile -> {
@ -301,7 +301,7 @@ public class Server {
}); });
} }
@CrossOrigin(origins = {"http://localhost:5173"}, allowCredentials = "true") @CrossOrigin
@PutMapping(path = "/api/makeAdmin", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PutMapping(path = "/api/makeAdmin", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void makeAdmin(@RequestParam("user-id") Long userId) { public void makeAdmin(@RequestParam("user-id") Long userId) {
profileManager.getProfile().ifPresent(userProfile -> { profileManager.getProfile().ifPresent(userProfile -> {
@ -317,7 +317,7 @@ public class Server {
}); });
} }
@CrossOrigin(origins = {"http://localhost:5173"}, allowCredentials = "true") @CrossOrigin
@PutMapping(path = "/api/removeAdmin", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @PutMapping(path = "/api/removeAdmin", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void removeAdmin(@RequestParam("user-id") Long userId) { public void removeAdmin(@RequestParam("user-id") Long userId) {
profileManager.getProfile().ifPresent(userProfile -> { profileManager.getProfile().ifPresent(userProfile -> {
@ -333,7 +333,7 @@ public class Server {
}); });
} }
@CrossOrigin(origins = {"http://localhost:5173"}, allowCredentials = "true") @CrossOrigin
@DeleteMapping(path = "/api/deleteUser", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) @DeleteMapping(path = "/api/deleteUser", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
public void deleteUser(@RequestParam("user-id") Long userId) { public void deleteUser(@RequestParam("user-id") Long userId) {
profileManager.getProfile().ifPresent(userProfile -> { profileManager.getProfile().ifPresent(userProfile -> {
@ -346,7 +346,7 @@ public class Server {
}); });
} }
@CrossOrigin(origins = {"http://localhost:5173"}, allowCredentials = "true") @CrossOrigin
@GetMapping(path = "/api/openid") @GetMapping(path = "/api/openid")
public OpenidSchema provideOpenidConfig() { public OpenidSchema provideOpenidConfig() {
OpenidSchema openidSchema = new OpenidSchema(); OpenidSchema openidSchema = new OpenidSchema();
@ -355,7 +355,7 @@ public class Server {
return openidSchema; return openidSchema;
} }
@CrossOrigin(origins = {"http://localhost:5173"}, allowCredentials = "true") @CrossOrigin
@PutMapping(path = "/api/hideMe") @PutMapping(path = "/api/hideMe")
public void hideUser() { public void hideUser() {
profileManager.getProfile().ifPresent(userProfile -> { profileManager.getProfile().ifPresent(userProfile -> {
@ -367,7 +367,7 @@ public class Server {
}); });
} }
@CrossOrigin(origins = {"http://localhost:5173"}, allowCredentials = "true") @CrossOrigin
@PutMapping(path = "/api/showMe") @PutMapping(path = "/api/showMe")
public void showUser() { public void showUser() {
profileManager.getProfile().ifPresent(userProfile -> { profileManager.getProfile().ifPresent(userProfile -> {