Skip to content

Commit

Permalink
feat: added updateTag function
Browse files Browse the repository at this point in the history
  • Loading branch information
zovomat committed Mar 22, 2022
1 parent cce172f commit 7492c57
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/boot/app/app-loader-functions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ import {
import { getSoapFetch, getXmlSoapFetch } from '../../network/fetch';
import { getTag, getTags, useTag, useTags } from '../../store/tags';
import { useNotify, useRefresh } from '../../store/network';
import { changeTagColor, createTag, deleteTag, renameTag } from '../../network/tags';
import { changeTagColor, createTag, deleteTag, renameTag, updateTag } from '../../network/tags';

// eslint-disable-next-line @typescript-eslint/ban-types
export const getAppFunctions = (pkg: CarbonioModule): Record<string, Function> => ({
Expand Down Expand Up @@ -124,6 +124,7 @@ export const getAppFunctions = (pkg: CarbonioModule): Record<string, Function> =
renameTag,
changeTagColor,
deleteTag,
updateTag,
// STUFF
useIsMobile,
getBridgedFunctions: (): unknown => {
Expand Down
7 changes: 7 additions & 0 deletions src/network/tags.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ export const renameTag = (id: string, name: string): Promise<TagActionResponse>
_jsns: 'urn:zimbraMail',
action: { op: 'rename', id, name }
});

export const updateTag = (tag: Partial<Tag> & { id: string }): Promise<TagActionResponse> =>
getSoapFetch(SHELL_APP_ID)<TagActionRequest, TagActionResponse>('TagAction', {
_jsns: 'urn:zimbraMail',
action: { op: 'update', ...tag }
});

export const changeTagColor = (id: string, color: string | number): Promise<TagActionResponse> =>
getSoapFetch(SHELL_APP_ID)<TagActionRequest, TagActionResponse>('TagAction', {
_jsns: 'urn:zimbraMail',
Expand Down
2 changes: 1 addition & 1 deletion types/tags/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
*/

export type Tag = {
color?: string;
color?: number;
id: string;
name: string;
rgb?: string;
Expand Down

0 comments on commit 7492c57

Please sign in to comment.