Skip to content

Commit

Permalink
🐛 (composable/event-loader) download先を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
Shion1305 committed Oct 25, 2023
1 parent 60eedfe commit ad43e49
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 3 deletions.
6 changes: 3 additions & 3 deletions composables/events-loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ import { EventData } from "~/model/eventData";

let events_data: EventData[] = [];

const zipUrl = useRuntimeConfig().public.baseURL + "/data/events.zip";

export async function useDataLoader() {
if (events_data.length > 0) return { events_data };
events_data = await (async function (): Promise<EventData[]> {
const downloaded_data: EventData[] = [];
try {
const zip_data = await fetch("/data/events.zip").then((res) =>
res.blob(),
);
const zip_data = await fetch(zipUrl).then((res) => res.blob());
const zip = await JSZip.loadAsync(zip_data);
const fileNames = Object.keys(zip.files);

Expand Down
7 changes: 7 additions & 0 deletions nuxt.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,11 @@ export default defineNuxtConfig({
],
},
},
runtimeConfig: {
publicRuntimeConfig: {
app: {
baseURL: process.env.BASE_URL ? process.env.BASE_URL : "/",
},
},
},
});

0 comments on commit ad43e49

Please sign in to comment.