make app usable without account, remove extra stuff

This commit is contained in:
m5r
2023-04-29 18:30:07 +02:00
parent cb35455722
commit 03ae466c66
128 changed files with 617 additions and 14061 deletions

View File

@ -2,21 +2,20 @@ import type { LoaderFunction } from "@remix-run/node";
import { json } from "superjson-remix";
import { Prisma } from "@prisma/client";
import { requireLoggedIn } from "~/utils/auth.server";
import db from "~/utils/db.server";
import { getSession } from "~/utils/session.server";
export type KeypadLoaderData = {
hasOngoingSubscription: boolean;
hasPhoneNumber: boolean;
lastRecipientCalled?: string;
};
const loader: LoaderFunction = async ({ request }) => {
const { twilio } = await requireLoggedIn(request);
const session = await getSession(request);
const twilio = session.get("twilio");
const phoneNumber = await db.phoneNumber.findUnique({
where: { twilioAccountSid_isCurrent: { twilioAccountSid: twilio?.accountSid ?? "", isCurrent: true } },
});
const hasOngoingSubscription = true; // TODO
const hasPhoneNumber = Boolean(phoneNumber);
const lastCall =
phoneNumber &&
@ -26,7 +25,6 @@ const loader: LoaderFunction = async ({ request }) => {
}));
return json<KeypadLoaderData>(
{
hasOngoingSubscription,
hasPhoneNumber,
lastRecipientCalled: lastCall?.recipient,
},