Fix Account Deletion
This commit is contained in:
@@ -96,7 +96,7 @@ public class AccountController {
|
||||
@RequestMapping(path = ACCOUNT_ADMIN, method = RequestMethod.DELETE, produces = "application/json")
|
||||
public ResponseEntity<Boolean> deleteAccount(HttpServletRequest request,
|
||||
@RequestParam(PARAM_EMAIL) String email,
|
||||
@RequestParam(PARAM_PASSWORD) UUID token,
|
||||
@RequestParam(PARAM_UUID) UUID token,
|
||||
@RequestParam(PARAM_ID) Long accountId) {
|
||||
logRequest(request);
|
||||
if (!sessionService.isAdmin(token, email)) {
|
||||
|
||||
@@ -38,7 +38,7 @@ export type SubmitLoginSession = {
|
||||
|
||||
export type AdminAccountOperation = {
|
||||
email: string;
|
||||
session: string;
|
||||
uuid: string;
|
||||
accountId: number;
|
||||
}
|
||||
|
||||
|
||||
@@ -62,11 +62,13 @@ export default function AccountsInfo() {
|
||||
};
|
||||
|
||||
const handleDeleteSelected = async () => {
|
||||
selectedRows.forEach(async (row) => {
|
||||
selectedRows.forEach(async (rowId) => {
|
||||
let id = rows.find((row) => row.id === rowId)?.id
|
||||
if(id === undefined) id = -1;
|
||||
await deleteAccount.mutateAsync({
|
||||
email: loginData?.email || '',
|
||||
session: loginData?.session || '',
|
||||
accountId: row.id as number
|
||||
uuid: loginData?.session || '',
|
||||
accountId: id,
|
||||
});
|
||||
})
|
||||
|
||||
|
||||
@@ -152,8 +152,8 @@ export const deleteAccount = async (user: User) => {
|
||||
return await response.json();
|
||||
};
|
||||
|
||||
export const deleteAccountAdmin = async (user: AdminAccountOperation) => {
|
||||
const response = await fetch('http://localhost:8085/account/admin?email=' + user.email + '&session=' + user.session + '&accountId=' + user.accountId, {
|
||||
export const deleteAccountAdmin = async (operation: AdminAccountOperation) => {
|
||||
const response = await fetch('http://localhost:8085/account/admin?email=' + operation.email + '&uuid=' + operation.uuid + '&id=' + operation.accountId, {
|
||||
method: 'DELETE',
|
||||
});
|
||||
if (!response.ok) {
|
||||
|
||||
Reference in New Issue
Block a user