forked from FoundKeyGang/FoundKey
replace note deletion API call with new request script
This commit is contained in:
parent
ef0f6af97f
commit
e194b32541
1 changed files with 6 additions and 7 deletions
|
@ -7,6 +7,7 @@ import * as os from '@/os';
|
||||||
import copyToClipboard from '@/scripts/copy-to-clipboard';
|
import copyToClipboard from '@/scripts/copy-to-clipboard';
|
||||||
import { url } from '@/config';
|
import { url } from '@/config';
|
||||||
import { noteActions } from '@/store';
|
import { noteActions } from '@/store';
|
||||||
|
import { del } from '@/scripts/request';
|
||||||
|
|
||||||
export function getNoteMenu(props: {
|
export function getNoteMenu(props: {
|
||||||
note: foundkey.entities.Note;
|
note: foundkey.entities.Note;
|
||||||
|
@ -25,20 +26,18 @@ export function getNoteMenu(props: {
|
||||||
|
|
||||||
const appearNote = isRenote ? props.note.renote as foundkey.entities.Note : props.note;
|
const appearNote = isRenote ? props.note.renote as foundkey.entities.Note : props.note;
|
||||||
|
|
||||||
function del(): void {
|
function deleteNote(): void {
|
||||||
os.confirm({
|
os.confirm({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
text: i18n.ts.noteDeleteConfirm,
|
text: i18n.ts.noteDeleteConfirm,
|
||||||
}).then(({ canceled }) => {
|
}).then(({ canceled }) => {
|
||||||
if (canceled) return;
|
if (canceled) return;
|
||||||
|
|
||||||
os.api('notes/delete', {
|
del(`/api/v2/notes/${appearNote.id}`);
|
||||||
noteId: appearNote.id,
|
|
||||||
});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function delEdit(): void {
|
function deleteEditNote(): void {
|
||||||
os.confirm({
|
os.confirm({
|
||||||
type: 'warning',
|
type: 'warning',
|
||||||
text: i18n.ts.deleteAndEditConfirm,
|
text: i18n.ts.deleteAndEditConfirm,
|
||||||
|
@ -310,13 +309,13 @@ export function getNoteMenu(props: {
|
||||||
appearNote.userId === $i.id ? {
|
appearNote.userId === $i.id ? {
|
||||||
icon: 'fas fa-edit',
|
icon: 'fas fa-edit',
|
||||||
text: i18n.ts.deleteAndEdit,
|
text: i18n.ts.deleteAndEdit,
|
||||||
action: delEdit,
|
action: deleteEditNote,
|
||||||
} : undefined,
|
} : undefined,
|
||||||
{
|
{
|
||||||
icon: 'fas fa-trash-alt',
|
icon: 'fas fa-trash-alt',
|
||||||
text: i18n.ts.delete,
|
text: i18n.ts.delete,
|
||||||
danger: true,
|
danger: true,
|
||||||
action: del,
|
action: deleteNote,
|
||||||
}]
|
}]
|
||||||
: []
|
: []
|
||||||
)]
|
)]
|
||||||
|
|
Loading…
Reference in a new issue