diff --git a/frontend/src/lib/api/api.js b/frontend/src/lib/api/api.js index a6cc8e4..a7cba8f 100644 --- a/frontend/src/lib/api/api.js +++ b/frontend/src/lib/api/api.js @@ -1616,10 +1616,12 @@ export class API { * Get a email by ID. * * @param {string} id + * @param {string|null} [companyID] * @returns {Promise} */ - getByID: async (id) => { - return await getJSON(this.getPath(`/email/${id}`)); + getByID: async (id, companyID = null) => { + const companyQuery = companyID ? `?${this.companyQuery(companyID)}` : ''; + return await getJSON(this.getPath(`/email/${id}${companyQuery}`)); }, /** diff --git a/frontend/src/routes/email/+page.svelte b/frontend/src/routes/email/+page.svelte index 38274b7..9645c59 100644 --- a/frontend/src/routes/email/+page.svelte +++ b/frontend/src/routes/email/+page.svelte @@ -212,7 +212,7 @@ /** @param {string} id */ const getEmail = async (id) => { try { - const res = await api.email.getByID(id); + const res = await api.email.getByID(id, contextCompanyID); if (!res.success) { throw res.error; } diff --git a/frontend/src/routes/email/[id]/attachments/+page.svelte b/frontend/src/routes/email/[id]/attachments/+page.svelte index 714a2a2..6b91ed0 100644 --- a/frontend/src/routes/email/[id]/attachments/+page.svelte +++ b/frontend/src/routes/email/[id]/attachments/+page.svelte @@ -118,7 +118,7 @@ const getEmail = async () => { try { - const res = await api.email.getByID($page.params.id); + const res = await api.email.getByID($page.params.id, contextCompanyID); if (!res.success) { throw res.error; }