diff --git a/public/index.js b/public/index.js index 7e6c207..86770f0 100644 --- a/public/index.js +++ b/public/index.js @@ -45,10 +45,8 @@ function renderAliases(aliases) { } }) - aDelete.classList.add('btn') - aDelete.classList.add('btn-danger') + aDelete.classList.add('btn', 'btn-danger') aDelete.innerText = 'Delete' - aDelete.setAttribute('href', `/aliases/${alias.id}`) tdActions.appendChild(aDelete) tr.appendChild(tdAddress) diff --git a/src/services/aliases/aliases.class.ts b/src/services/aliases/aliases.class.ts index af938e3..59941e1 100644 --- a/src/services/aliases/aliases.class.ts +++ b/src/services/aliases/aliases.class.ts @@ -123,11 +123,10 @@ export class AliasesService ) { throw new BadRequest("Unable to delete address"); } - - await wildDuckClient.delete(`/addresses/${id}`); - const userId = await this.getUserIdByEmailAddress(params); + await wildDuckClient.delete(`users/${userId}/addresses/${id}`); + return this.getUserAddresses(userId); } } diff --git a/src/services/aliases/aliases.ts b/src/services/aliases/aliases.ts index 0a6ed37..97ba226 100644 --- a/src/services/aliases/aliases.ts +++ b/src/services/aliases/aliases.ts @@ -3,7 +3,7 @@ import { validateAuth } from "../../hooks/validate-auth"; import { AliasesService, getOptions } from "./aliases.class"; export const aliasesPath = "aliases"; -export const aliasesMethods = ["find", "create"] as const; +export const aliasesMethods = ["find", "create", "remove"] as const; export * from "./aliases.class";