Skip to content

Commit

Permalink
chore: remove proxy service to trigger ics download instantly (#37)
Browse files Browse the repository at this point in the history
Remove proxy bypassing CORS
  • Loading branch information
OLILHR authored Jan 10, 2025
1 parent 8a7d879 commit d60a012
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions src/lib/services/download-ics.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
export async function downloadCalendar(year: number): Promise<void> {
try {
const apiEndpoint = `https://fristenkalender.azurewebsites.net/api/GenerateAndExportWholeCalendar/calendar/[email protected]/${year}`;
const proxyUrl = `https://api.allorigins.win/raw?url=${encodeURIComponent(apiEndpoint)}`;

const response = await fetch(proxyUrl);
const response = await fetch(apiEndpoint);
if (!response.ok) {
throw new Error(`HTTP error! status: ${response.status}`);
}
Expand All @@ -14,7 +13,7 @@ export async function downloadCalendar(year: number): Promise<void> {

const link = document.createElement("a");
link.href = url;
link.download = `HFFristenkalender${year}.ics`;
link.download = `Hochfrequenz_Fristenkalender_${year}.ics`;

document.body.appendChild(link);
link.click();
Expand Down

0 comments on commit d60a012

Please sign in to comment.