feat: use cal video as the default location (#6643)

* feat: use cal video as default while creating new events

* feat: use cal video as default value

* chore: remove default value

* fix: default value logic

* chore: remove console.log
This commit is contained in:
Nafees Nazik
2023-01-24 15:28:40 +00:00
committed by GitHub
parent 905a110377
commit 796a5f8d51
2 changed files with 5 additions and 7 deletions
@@ -139,11 +139,13 @@ export const EventSetupTab = (
return true;
});
const defaultValue = locationOptions.find((item) => item.label === "video")?.options;
return (
<div className="w-full">
{validLocations.length === 0 && (
<div className="flex">
<LocationSelect
defaultValue={defaultValue}
placeholder={t("select")}
options={locationOptions}
isSearchable={false}
@@ -404,7 +404,7 @@ export const eventTypesRouter = router({
create: authedProcedure.input(createEventTypeInput).mutation(async ({ ctx, input }) => {
const { schedulingType, teamId, ...rest } = input;
const userId = ctx.user.id;
const appKeys = await getAppKeysFromSlug("daily-video");
const data: Prisma.EventTypeCreateInput = {
...rest,
owner: teamId ? undefined : { connect: { id: userId } },
@@ -413,14 +413,10 @@ export const eventTypesRouter = router({
id: userId,
},
},
...((typeof rest?.locations === "undefined" || rest.locations?.length === 0) &&
typeof appKeys.api_key === "string" && { locations: [{ type: DailyLocationType }] }),
};
const appKeys = await getAppKeysFromSlug("daily-video");
// Shouldn't override input locations
if (rest.locations?.length === 0 && typeof appKeys.api_key === "string") {
data.locations = [{ type: DailyLocationType }];
}
if (teamId && schedulingType) {
const hasMembership = await ctx.prisma.membership.findFirst({
where: {