mirror of
https://github.com/Myzel394/kleckrelay-website.git
synced 2025-06-19 07:55:25 +02:00
feat: Add delete alias
This commit is contained in:
parent
00b983aed2
commit
6490aad2ed
@ -203,6 +203,13 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"actions": {
|
||||||
|
"delete": {
|
||||||
|
"label": "Delete Alias",
|
||||||
|
"description": "Are you sure you want to delete this alias?",
|
||||||
|
"continueAction": "Delete Alias"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"ReportsRoute": {
|
"ReportsRoute": {
|
||||||
@ -506,7 +513,8 @@
|
|||||||
"notesUpdated": "Updated & encrypted notes successfully!",
|
"notesUpdated": "Updated & encrypted notes successfully!",
|
||||||
"aliasChangedToEnabled": "Alias has been enabled",
|
"aliasChangedToEnabled": "Alias has been enabled",
|
||||||
"aliasChangedToDisabled": "Alias has been disabled",
|
"aliasChangedToDisabled": "Alias has been disabled",
|
||||||
"addressCopiedToClipboard": "Address has been copied to your clipboard!"
|
"addressCopiedToClipboard": "Address has been copied to your clipboard!",
|
||||||
|
"aliasDeleted": "Alias has been deleted!"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"settings": {
|
"settings": {
|
||||||
|
@ -2,7 +2,7 @@ import {client} from "~/constants/axios-client"
|
|||||||
import {SimpleDetailResponse} from "~/server-types"
|
import {SimpleDetailResponse} from "~/server-types"
|
||||||
|
|
||||||
export default async function deleteAlias(id: string): Promise<SimpleDetailResponse> {
|
export default async function deleteAlias(id: string): Promise<SimpleDetailResponse> {
|
||||||
const {data} = await client.delete(`${import.meta.env.VITE_SERVER_BASE_URL}/v1/report/${id}`, {
|
const {data} = await client.delete(`${import.meta.env.VITE_SERVER_BASE_URL}/v1/alias/${id}`, {
|
||||||
withCredentials: true,
|
withCredentials: true,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -6,12 +6,13 @@ import {useTranslation} from "react-i18next"
|
|||||||
import {useQuery} from "@tanstack/react-query"
|
import {useQuery} from "@tanstack/react-query"
|
||||||
import {Grid} from "@mui/material"
|
import {Grid} from "@mui/material"
|
||||||
|
|
||||||
import {getAlias} from "~/apis"
|
import {deleteAlias, getAlias} from "~/apis"
|
||||||
import {Alias, DecryptedAlias, ServerSettings} from "~/server-types"
|
import {Alias, DecryptedAlias, ServerSettings} from "~/server-types"
|
||||||
import {
|
import {
|
||||||
AliasTypeIndicator,
|
AliasTypeIndicator,
|
||||||
AuthContext,
|
AuthContext,
|
||||||
DecryptionPasswordMissingAlert,
|
DecryptionPasswordMissingAlert,
|
||||||
|
DeleteButton,
|
||||||
EncryptionStatus,
|
EncryptionStatus,
|
||||||
QueryResult,
|
QueryResult,
|
||||||
SimplePage,
|
SimplePage,
|
||||||
@ -46,7 +47,18 @@ export default function AliasDetailRoute(): ReactElement {
|
|||||||
return (
|
return (
|
||||||
<SimplePage
|
<SimplePage
|
||||||
title={t("routes.AliasDetailRoute.title")}
|
title={t("routes.AliasDetailRoute.title")}
|
||||||
actions={query.data && <DeleteButton id={query.data.id} />}
|
actions={
|
||||||
|
query.data && (
|
||||||
|
<DeleteButton
|
||||||
|
onDelete={() => deleteAlias(aliasID!)}
|
||||||
|
label={t("routes.AliasDetailRoute.actions.delete.label")}
|
||||||
|
description={t("routes.AliasDetailRoute.actions.delete.description")}
|
||||||
|
continueLabel={t("routes.AliasDetailRoute.actions.delete.continueAction")}
|
||||||
|
navigateTo={"/aliases"}
|
||||||
|
successMessage={t("relations.alias.mutations.success.aliasDeleted")}
|
||||||
|
/>
|
||||||
|
)
|
||||||
|
}
|
||||||
>
|
>
|
||||||
<QueryResult<Alias | DecryptedAlias> query={query}>
|
<QueryResult<Alias | DecryptedAlias> query={query}>
|
||||||
{alias => (
|
{alias => (
|
||||||
|
Loading…
x
Reference in New Issue
Block a user