Fix creating and deleting calendars
This fixes the creation and deletion of calendars to include a color and the proper chosen name.
This commit is contained in:
@@ -2,6 +2,7 @@ import { Handlers } from 'fresh/server.ts';
|
||||
|
||||
import { FreshContextState } from '/lib/types.ts';
|
||||
import { Calendar, CalendarModel } from '/lib/models/calendar.ts';
|
||||
import { getColorAsHex } from '/lib/utils/calendar.ts';
|
||||
|
||||
interface Data {}
|
||||
|
||||
@@ -23,7 +24,7 @@ export const handler: Handlers<Data, FreshContextState> = {
|
||||
const requestBody = await request.clone().json() as RequestBody;
|
||||
|
||||
if (requestBody.name) {
|
||||
await CalendarModel.create(context.state.user.id, requestBody.name);
|
||||
await CalendarModel.create(context.state.user.id, requestBody.name, getColorAsHex('bg-gray-700'));
|
||||
}
|
||||
|
||||
const newCalendars = await CalendarModel.list(context.state.user.id);
|
||||
|
||||
Reference in New Issue
Block a user