Skip to content

Commit

Permalink
fix: indentation, semicolons and quoting
Browse files Browse the repository at this point in the history
  • Loading branch information
wscourge committed Jul 29, 2023
1 parent 30fcccd commit 2dd4d24
Showing 1 changed file with 29 additions and 29 deletions.
58 changes: 29 additions & 29 deletions examples/example-nextjs13.js
Original file line number Diff line number Diff line change
@@ -1,41 +1,41 @@
// app/api/calendar/route.ts

import icalendar from "ical-generator"
import moment from "moment"
import icalendar from 'ical-generator';
import moment from 'moment';

export async function GET(req) {
if (req.method !== "GET") {
return new Response("Method Not Allowed", {
headers: { Allow: "GET" },
status: 405,
})
if (req.method !== 'GET') {
return new Response('Method Not Allowed', {
headers: { Allow: 'GET' },
status: 405,
});
}

const filename = "calendar.ics"
const filename = 'calendar.ics';

try {
const calendar = icalendar({
prodId: "//superman-industries.com//ical-generator//EN",
events: [
{
start: moment(),
end: moment().add(1, "hour"),
summary: "Example Event",
description: "It works ;)",
url: "https://example.com"
}
]
});
const calendar = icalendar({
prodId: '//superman-industries.com//ical-generator//EN',
events: [
{
start: moment(),
end: moment().add(1, 'hour'),
summary: 'Example Event',
description: 'It works ;)',
url: 'https://example.com'
}
]
});

return new Response(calendar.toString(), {
headers: {
"Content-Type": "text/calendar; charset=utf-8",
"Content-Disposition": `attachment; filename="${filename}"`,
},
status: 200,
})
return new Response(calendar.toString(), {
headers: {
'Content-Type': 'text/calendar; charset=utf-8',
'Content-Disposition': `attachment; filename='${filename}'`,
},
status: 200,
});
} catch (err) {
console.error(err)
return new Response(JSON.stringify(err), { status: 500 })
console.error(err);
return new Response(JSON.stringify(err), { status: 500 });
}
}

0 comments on commit 2dd4d24

Please sign in to comment.