Skip to content

Commit

Permalink
fix: temporary history
Browse files Browse the repository at this point in the history
  • Loading branch information
mattiasghodsian committed Aug 17, 2024
1 parent e2f36b0 commit e559214
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions src-frontend/views/DownloadView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@ import { useApiStore } from '@/stores/api.ts';
import { useToast } from 'primevue/usetoast';
import IconDownload from '@/components/icons/IconDownload.vue';
interface DownloadHistoryItem {
url: string;
file: string;
path: string;
timestamp: string;
}
const toast = useToast();
const apiStore = useApiStore();
Expand All @@ -12,7 +19,7 @@ const formatType = ref<string>('');
const metaData = ref<boolean>(true);
const saveTo = ref<string>('');
const loading = ref<boolean>(false);
const downloadHistory = ref<[{}]>([]);
const downloadHistory = ref<DownloadHistoryItem[]>([]);
const getFormattedTimestamp = () => {
const date = new Date();
Expand Down Expand Up @@ -64,7 +71,7 @@ const download = async (): Promise<void> => {
detail: `${response.name} saved to ${response.path}.`,
life: 3000
});
downloadHistory.value.push({
downloadHistory.value.unshift({
url: videoUrl.value,
file: response.name,
path: response.path,
Expand All @@ -76,7 +83,7 @@ const download = async (): Promise<void> => {
toast.add({
severity: 'error',
summary: 'Error',
detail: err.message,
detail: err,
life: 3000
});
}).finally(() => {
Expand Down Expand Up @@ -120,7 +127,7 @@ const download = async (): Promise<void> => {
<div class="w-full text-center pb-1">
<label class="text-white font-bold ">Temporary History (reload to clear)</label>
</div>
<DataTable :value="downloadHistory.reverse()" dataKey="timestamp" class="rounded max-h-96 overflow-y-auto">
<DataTable :value="downloadHistory" dataKey="timestamp" class="rounded max-h-96 overflow-y-auto">
<Column field="file" header="Local file"></Column>
<Column field="path" header="Path"></Column>
<!-- <Column field="url" header="url"></Column> -->
Expand Down

0 comments on commit e559214

Please sign in to comment.