GroupExportData Component

This commit is contained in:
Kuchenpirat 2025-07-29 22:31:03 +00:00
commit 0a7368857d

View file

@ -20,45 +20,33 @@
</v-data-table> </v-data-table>
</template> </template>
<script lang="ts"> <script setup lang="ts">
import { parseISO, formatDistanceToNow } from "date-fns"; import { parseISO, formatDistanceToNow } from "date-fns";
import type { GroupDataExport } from "~/lib/api/types/group"; import type { GroupDataExport } from "~/lib/api/types/group";
export default defineNuxtComponent({ defineProps<{
props: { exports: GroupDataExport[];
exports: { }>();
type: Array as () => GroupDataExport[],
required: true,
},
},
setup() {
const i18n = useI18n();
const headers = [ const i18n = useI18n();
{ title: i18n.t("export.export"), value: "name" },
{ title: i18n.t("export.file-name"), value: "filename" },
{ title: i18n.t("export.size"), value: "size" },
{ title: i18n.t("export.link-expires"), value: "expires" },
{ title: "", value: "actions" },
];
function getTimeToExpire(timeString: string) { const headers = [
const expiresAt = parseISO(timeString); { title: i18n.t("export.export"), value: "name" },
{ title: i18n.t("export.file-name"), value: "filename" },
{ title: i18n.t("export.size"), value: "size" },
{ title: i18n.t("export.link-expires"), value: "expires" },
{ title: "", value: "actions" },
];
return formatDistanceToNow(expiresAt, { function getTimeToExpire(timeString: string) {
addSuffix: false, const expiresAt = parseISO(timeString);
});
}
function downloadData(_: any) { return formatDistanceToNow(expiresAt, {
console.log("Downloading data..."); addSuffix: false,
} });
}
return { function downloadData(_: any) {
downloadData, console.log("Downloading data...");
headers, }
getTimeToExpire,
};
},
});
</script> </script>