Skip to content

Commit

Permalink
#162 fix attachments api mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Kreezag authored and Kreezag committed Jun 14, 2024
1 parent 365d009 commit 35cce07
Show file tree
Hide file tree
Showing 5 changed files with 8 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/screens/http-dump/ui/http-dump-page/http-dump-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ const hasAttachments = computed(
<div class="http-dump-page__attachments">
<FileAttachment
v-for="file in event.payload.request.files"
:key="file.id"
:key="file.uuid"
:event-id="event.id"
:attachment="file"
/>
Expand Down
6 changes: 1 addition & 5 deletions src/screens/smtp/ui/smtp-page/smtp-page.vue
Original file line number Diff line number Diff line change
Expand Up @@ -129,11 +129,7 @@ const date = computed(() =>
<section class="mb-5">
<div class="flex gap-x-3">
<template v-for="a in attachments" :key="a.uuid">
<FileAttachment
:event-id="event.id"
:event="event"
:attachment="a"
/>
<FileAttachment :event-id="event.id" :attachment="a" />
</template>
</div>
</section>
Expand Down
4 changes: 2 additions & 2 deletions src/shared/lib/io/use-smtp-requests.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ export const useSmtpRequests: TUseSmtpRequests = () => {
.then((response) => {
if (response?.data) {
return (response.data as SMTPAttachment[]).map((attachment) => ({
id: attachment.uuid,
uuid: attachment.uuid,
name: attachment.name,
size: attachment.size,
mime: attachment.mime,
uri: attachment.path
}))
} as Attachment))
}

if (response?.code === 403) {
Expand Down
4 changes: 3 additions & 1 deletion src/shared/types/partials.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import type {Uuid} from "./events";

export interface Source {
file: string,
name: string,
Expand All @@ -6,7 +8,7 @@ export interface Source {
}

export interface Attachment {
id: string,
uuid: Uuid,
name: string,
size: number,
mime: string,
Expand Down
2 changes: 1 addition & 1 deletion src/shared/ui/file-attachment/file-attachment.vue
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const props = defineProps<Props>();
const size = computed(() => formatFileSize(props.attachment.size || 0));
const downloadUrl = computed(
() =>
`${REST_API_URL}/api/smtp/${props.eventId}/attachments/${props.attachment.id}`
`${REST_API_URL}/api/smtp/${props.eventId}/attachments/${props.attachment.uuid}`
);
</script>

Expand Down

0 comments on commit 35cce07

Please sign in to comment.