mirror of
https://github.com/rustmailer/bichon.git
synced 2026-08-03 07:48:34 +02:00
feat: Ability to add/remove tags from any list of messages #189
This commit is contained in:
@@ -21,9 +21,12 @@ import { update_tags } from '@/api/search/api';
|
||||
import { useMutation, useQueryClient } from '@tanstack/react-query';
|
||||
import { toast } from './use-toast';
|
||||
|
||||
|
||||
export type TagAction = 'Add' | 'Remove' | 'Overwrite';
|
||||
export interface UpdateTagsParams {
|
||||
updates: Record<number, string[]>;
|
||||
tags: string[];
|
||||
action: TagAction;
|
||||
}
|
||||
|
||||
export function useUpdateTags() {
|
||||
@@ -31,12 +34,7 @@ export function useUpdateTags() {
|
||||
|
||||
return useMutation({
|
||||
mutationFn: async (params: UpdateTagsParams) => {
|
||||
const { updates, tags } = params;
|
||||
const payload = {
|
||||
updates,
|
||||
tags
|
||||
};
|
||||
return update_tags(payload);
|
||||
return update_tags(params);
|
||||
},
|
||||
|
||||
onSuccess: () => {
|
||||
|
||||
Reference in New Issue
Block a user