Zammad send fixes, update deps
This commit is contained in:
parent
c47223f5e9
commit
a4053e6412
29 changed files with 626 additions and 500 deletions
|
|
@ -15,7 +15,7 @@ export const createTicketAction = async (
|
|||
try {
|
||||
const ticket = {
|
||||
groupId: formData.get("groupId"),
|
||||
customerId: `gid://zammad/User/3`, // { email: formData.get("customerId") },
|
||||
customerId: formData.get("customerId"),
|
||||
title: formData.get("title"),
|
||||
article: {
|
||||
internal: true,
|
||||
|
|
@ -23,16 +23,13 @@ export const createTicketAction = async (
|
|||
},
|
||||
};
|
||||
|
||||
console.log({ ticket });
|
||||
|
||||
const result = await executeGraphQL({
|
||||
await executeGraphQL({
|
||||
query: createTicketMutation,
|
||||
variables: {
|
||||
input: ticket,
|
||||
},
|
||||
});
|
||||
|
||||
console.log({ result });
|
||||
return {
|
||||
...currentState,
|
||||
values: ticket,
|
||||
|
|
@ -61,7 +58,6 @@ export const createTicketArticleAction = async (
|
|||
},
|
||||
});
|
||||
|
||||
console.log({ result });
|
||||
return {
|
||||
result,
|
||||
success: true,
|
||||
|
|
@ -114,10 +110,8 @@ export const updateTicketAction = async (
|
|||
tags: ticketInfo.tags,
|
||||
},
|
||||
});
|
||||
console.log({ tagsResult });
|
||||
}
|
||||
|
||||
console.log({ result });
|
||||
return {
|
||||
result,
|
||||
success: true,
|
||||
|
|
@ -132,55 +126,80 @@ export const updateTicketAction = async (
|
|||
};
|
||||
|
||||
export const getTicketAction = async (id: string) => {
|
||||
const ticketData = await executeGraphQL({
|
||||
query: getTicketQuery,
|
||||
variables: { ticketId: `gid://zammad/Ticket/${id}` },
|
||||
});
|
||||
console.log({ td: ticketData.ticket });
|
||||
return ticketData?.ticket;
|
||||
try {
|
||||
const ticketData = await executeGraphQL({
|
||||
query: getTicketQuery,
|
||||
variables: { ticketId: `gid://zammad/Ticket/${id}` },
|
||||
});
|
||||
|
||||
return ticketData?.ticket;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
export const getTicketArticlesAction = async (id: string) => {
|
||||
const ticketData = await executeGraphQL({
|
||||
query: getTicketArticlesQuery,
|
||||
variables: { ticketId: `gid://zammad/Ticket/${id}` },
|
||||
});
|
||||
try {
|
||||
const ticketData = await executeGraphQL({
|
||||
query: getTicketArticlesQuery,
|
||||
variables: { ticketId: `gid://zammad/Ticket/${id}` },
|
||||
});
|
||||
|
||||
return ticketData?.ticketArticles;
|
||||
return ticketData?.ticketArticles;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return {};
|
||||
}
|
||||
};
|
||||
|
||||
export const getTicketStatesAction = async () => {
|
||||
const states = await executeREST({
|
||||
path: "/api/v1/ticket_states",
|
||||
});
|
||||
try {
|
||||
const states = await executeREST({
|
||||
path: "/api/v1/ticket_states",
|
||||
});
|
||||
|
||||
const formattedStates =
|
||||
states?.map((state: any) => ({
|
||||
value: `gid://zammad/Ticket::State/${state.id}`,
|
||||
label: state.name,
|
||||
})) ?? [];
|
||||
const formattedStates =
|
||||
states?.map((state: any) => ({
|
||||
value: `gid://zammad/Ticket::State/${state.id}`,
|
||||
label: state.name,
|
||||
})) ?? [];
|
||||
|
||||
return formattedStates;
|
||||
return formattedStates;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
export const getTagsAction = async () => {
|
||||
const { tags } = await executeREST({
|
||||
path: "/api/v1/tags",
|
||||
});
|
||||
try {
|
||||
const { tags } = await executeREST({
|
||||
path: "/api/v1/tags",
|
||||
});
|
||||
|
||||
return tags;
|
||||
return tags;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
||||
export const getTicketPrioritiesAction = async () => {
|
||||
const priorities = await executeREST({
|
||||
path: "/api/v1/ticket_priorities",
|
||||
});
|
||||
try {
|
||||
const priorities = await executeREST({
|
||||
path: "/api/v1/ticket_priorities",
|
||||
});
|
||||
|
||||
const formattedPriorities =
|
||||
priorities?.map((priority: any) => ({
|
||||
value: `gid://zammad/Ticket::Priority/${priority.id}`,
|
||||
label: priority.name,
|
||||
})) ?? [];
|
||||
const formattedPriorities =
|
||||
priorities?.map((priority: any) => ({
|
||||
value: `gid://zammad/Ticket::Priority/${priority.id}`,
|
||||
label: priority.name,
|
||||
})) ?? [];
|
||||
|
||||
return formattedPriorities;
|
||||
return formattedPriorities;
|
||||
} catch (e) {
|
||||
console.error(e);
|
||||
return [];
|
||||
}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue