Turned the e-mails to be dependent on the environment
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
</p>
|
</p>
|
||||||
<br />
|
<br />
|
||||||
<p>Don't forget to do it before its end date!</p>
|
<p>Don't forget to do it before its end date!</p>
|
||||||
<p>Click <b><a href="https://platform.encoach.com">here</a></b> to open the EnCoach Platform!</p>
|
<p>Click <b><a href="https://{{environment}}.encoach.com">here</a></b> to open the EnCoach Platform!</p>
|
||||||
<br />
|
<br />
|
||||||
<p>Thanks,</p>
|
<p>Thanks,</p>
|
||||||
<p>Your EnCoach team</p>
|
<p>Your EnCoach team</p>
|
||||||
|
|||||||
@@ -11,7 +11,8 @@
|
|||||||
<img src="/logo_title.png" class="w-48 h-48 self-center" />
|
<img src="/logo_title.png" class="w-48 h-48 self-center" />
|
||||||
<div>
|
<div>
|
||||||
<span>Hello future {{type}} of <b>EnCoach</b>,</span><br />
|
<span>Hello future {{type}} of <b>EnCoach</b>,</span><br />
|
||||||
<span>You have been invited to register at <a href="https://platform.encoach.com/register?code={{code}}">EnCoach</a>
|
<span>You have been invited to register at <a
|
||||||
|
href="https://{{environment}}.encoach.com/register?code={{code}}">EnCoach</a>
|
||||||
to
|
to
|
||||||
become a
|
become a
|
||||||
{{type}}!</span><br />
|
{{type}}!</span><br />
|
||||||
@@ -19,7 +20,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<a href="https://platform.encoach.com/register?code={{code}}"></a>
|
<a href="https://{{environment}}.encoach.com/register?code={{code}}"></a>
|
||||||
<span class="self-center p-4 px-12 text-lg text-[#]" style="background-color: #D5D9F0; color: #353338">
|
<span class="self-center p-4 px-12 text-lg text-[#]" style="background-color: #D5D9F0; color: #353338">
|
||||||
<b>{{code}}</b>
|
<b>{{code}}</b>
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
@@ -10,7 +10,8 @@
|
|||||||
<p>Hello {{name}},</p>
|
<p>Hello {{name}},</p>
|
||||||
<br />
|
<br />
|
||||||
<p>Follow this link to verify your email address.</p>
|
<p>Follow this link to verify your email address.</p>
|
||||||
<a href="https://platform.encoach.com/action?mode=signIn&continueUrl={{email}}&oobCode={{code}}">Verify account</a>
|
<a href="https://{{environment}}.encoach.com/action?mode=signIn&continueUrl={{email}}&oobCode={{code}}">Verify
|
||||||
|
account</a>
|
||||||
<br />
|
<br />
|
||||||
<br />
|
<br />
|
||||||
<p>If you didn’t ask to verify this address, you can ignore this email.</p>
|
<p>If you didn’t ask to verify this address, you can ignore this email.</p>
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "Tiago Ribeiro",
|
"name": "Tiago Ribeiro",
|
||||||
"email": "tiago.ribeiro@ecrop.dev",
|
"email": "tiago.ribeiro@ecrop.dev",
|
||||||
"code": "123"
|
"code": "123",
|
||||||
|
"environment": "platform"
|
||||||
}
|
}
|
||||||
@@ -40,15 +40,7 @@ export function getServerSideProps({
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
export default function Reset({
|
export default function Reset({code, mode, continueUrl}: {code: string; mode: string; continueUrl?: string}) {
|
||||||
code,
|
|
||||||
mode,
|
|
||||||
continueUrl,
|
|
||||||
}: {
|
|
||||||
code: string;
|
|
||||||
mode: string;
|
|
||||||
continueUrl?: string;
|
|
||||||
}) {
|
|
||||||
const [password, setPassword] = useState("");
|
const [password, setPassword] = useState("");
|
||||||
const [isLoading, setIsLoading] = useState(false);
|
const [isLoading, setIsLoading] = useState(false);
|
||||||
|
|
||||||
@@ -63,7 +55,7 @@ export default function Reset({
|
|||||||
if (mode === "signIn") {
|
if (mode === "signIn") {
|
||||||
axios
|
axios
|
||||||
.post<{ok: boolean}>("/api/reset/verify", {
|
.post<{ok: boolean}>("/api/reset/verify", {
|
||||||
email: continueUrl?.replace("https://platform.encoach.com/", ""),
|
email: continueUrl?.replace("https://platform.encoach.com/", "").replace("https://staging.encoach.com/", ""),
|
||||||
})
|
})
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
if (response.data.ok) {
|
if (response.data.ok) {
|
||||||
@@ -76,20 +68,14 @@ export default function Reset({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
toast.error(
|
toast.error("Something went wrong! Please make sure to click the link in your e-mail again and input the correct e-mail!", {
|
||||||
"Something went wrong! Please make sure to click the link in your e-mail again and input the correct e-mail!",
|
|
||||||
{
|
|
||||||
toastId: "verify-error",
|
toastId: "verify-error",
|
||||||
},
|
});
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
toast.error(
|
toast.error("Something went wrong! Please make sure to click the link in your e-mail again and input the correct e-mail!", {
|
||||||
"Something went wrong! Please make sure to click the link in your e-mail again and input the correct e-mail!",
|
|
||||||
{
|
|
||||||
toastId: "verify-error",
|
toastId: "verify-error",
|
||||||
},
|
});
|
||||||
);
|
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -112,16 +98,10 @@ export default function Reset({
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
toast.error(
|
toast.error("Something went wrong! Please make sure to click the link in your e-mail again!", {toastId: "reset-error"});
|
||||||
"Something went wrong! Please make sure to click the link in your e-mail again!",
|
|
||||||
{ toastId: "reset-error" },
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.catch(() => {
|
||||||
toast.error(
|
toast.error("Something went wrong! Please make sure to click the link in your e-mail again!", {toastId: "reset-error"});
|
||||||
"Something went wrong! Please make sure to click the link in your e-mail again!",
|
|
||||||
{ toastId: "reset-error" },
|
|
||||||
);
|
|
||||||
})
|
})
|
||||||
.finally(() => setIsLoading(false));
|
.finally(() => setIsLoading(false));
|
||||||
};
|
};
|
||||||
@@ -138,51 +118,24 @@ export default function Reset({
|
|||||||
<ToastContainer />
|
<ToastContainer />
|
||||||
<section className="relative hidden h-full w-fit min-w-fit lg:flex">
|
<section className="relative hidden h-full w-fit min-w-fit lg:flex">
|
||||||
<div className="bg-mti-rose-light absolute z-10 h-full w-full bg-opacity-50" />
|
<div className="bg-mti-rose-light absolute z-10 h-full w-full bg-opacity-50" />
|
||||||
<img
|
<img src="/people-talking-tablet.png" alt="People smiling looking at a tablet" className="aspect-auto h-full" />
|
||||||
src="/people-talking-tablet.png"
|
|
||||||
alt="People smiling looking at a tablet"
|
|
||||||
className="aspect-auto h-full"
|
|
||||||
/>
|
|
||||||
</section>
|
</section>
|
||||||
{mode === "resetPassword" && (
|
{mode === "resetPassword" && (
|
||||||
<section className="flex h-full w-full flex-col items-center justify-center gap-2">
|
<section className="flex h-full w-full flex-col items-center justify-center gap-2">
|
||||||
<div className="relative flex flex-col items-center gap-2">
|
<div className="relative flex flex-col items-center gap-2">
|
||||||
<img
|
<img src="/logo_title.png" alt="EnCoach's Logo" className="absolute -top-36 w-36 lg:-top-64 lg:w-64" />
|
||||||
src="/logo_title.png"
|
<h1 className="text-2xl font-bold lg:text-4xl">Reset your password</h1>
|
||||||
alt="EnCoach's Logo"
|
<p className="text-mti-gray-cool self-start text-sm font-normal lg:text-base">to your registered Email Address</p>
|
||||||
className="absolute -top-36 w-36 lg:-top-64 lg:w-64"
|
|
||||||
/>
|
|
||||||
<h1 className="text-2xl font-bold lg:text-4xl">
|
|
||||||
Reset your password
|
|
||||||
</h1>
|
|
||||||
<p className="text-mti-gray-cool self-start text-sm font-normal lg:text-base">
|
|
||||||
to your registered Email Address
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<Divider className="max-w-xs lg:max-w-md" />
|
<Divider className="max-w-xs lg:max-w-md" />
|
||||||
<form
|
<form className="-lg:px-8 flex w-full flex-col items-center gap-6 lg:w-1/2" onSubmit={login}>
|
||||||
className="-lg:px-8 flex w-full flex-col items-center gap-6 lg:w-1/2"
|
<Input type="password" name="password" onChange={(e) => setPassword(e)} placeholder="Password" />
|
||||||
onSubmit={login}
|
|
||||||
>
|
|
||||||
<Input
|
|
||||||
type="password"
|
|
||||||
name="password"
|
|
||||||
onChange={(e) => setPassword(e)}
|
|
||||||
placeholder="Password"
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
<Button className="mt-8 w-full" color="purple" disabled={isLoading}>
|
||||||
className="mt-8 w-full"
|
|
||||||
color="purple"
|
|
||||||
disabled={isLoading}
|
|
||||||
>
|
|
||||||
{!isLoading && "Reset"}
|
{!isLoading && "Reset"}
|
||||||
{isLoading && (
|
{isLoading && (
|
||||||
<div className="flex items-center justify-center">
|
<div className="flex items-center justify-center">
|
||||||
<BsArrowRepeat
|
<BsArrowRepeat className="animate-spin text-white" size={25} />
|
||||||
className="animate-spin text-white"
|
|
||||||
size={25}
|
|
||||||
/>
|
|
||||||
</div>
|
</div>
|
||||||
)}
|
)}
|
||||||
</Button>
|
</Button>
|
||||||
@@ -198,25 +151,15 @@ export default function Reset({
|
|||||||
{mode === "signIn" && (
|
{mode === "signIn" && (
|
||||||
<section className="flex h-full w-full flex-col items-center justify-center gap-2">
|
<section className="flex h-full w-full flex-col items-center justify-center gap-2">
|
||||||
<div className="relative flex flex-col items-center gap-2">
|
<div className="relative flex flex-col items-center gap-2">
|
||||||
<img
|
<img src="/logo_title.png" alt="EnCoach's Logo" className="absolute -top-36 w-36 lg:-top-64 lg:w-64" />
|
||||||
src="/logo_title.png"
|
<h1 className="text-2xl font-bold lg:text-4xl">Confirm your account</h1>
|
||||||
alt="EnCoach's Logo"
|
<p className="text-mti-gray-cool self-start text-sm font-normal lg:text-base">to your registered Email Address</p>
|
||||||
className="absolute -top-36 w-36 lg:-top-64 lg:w-64"
|
|
||||||
/>
|
|
||||||
<h1 className="text-2xl font-bold lg:text-4xl">
|
|
||||||
Confirm your account
|
|
||||||
</h1>
|
|
||||||
<p className="text-mti-gray-cool self-start text-sm font-normal lg:text-base">
|
|
||||||
to your registered Email Address
|
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
<Divider className="max-w-xs lg:max-w-md" />
|
<Divider className="max-w-xs lg:max-w-md" />
|
||||||
<div className="-lg:px-8 flex w-full flex-col items-center gap-6 lg:w-1/2">
|
<div className="-lg:px-8 flex w-full flex-col items-center gap-6 lg:w-1/2">
|
||||||
<span className="text-center">
|
<span className="text-center">
|
||||||
Your e-mail is currently being verified, please wait a second.{" "}
|
Your e-mail is currently being verified, please wait a second. <br /> <br />
|
||||||
<br /> <br />
|
Once it has been verified, you will be redirected to the home page.
|
||||||
Once it has been verified, you will be redirected to the home
|
|
||||||
page.
|
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
|
|||||||
@@ -163,6 +163,7 @@ async function POST(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
modules: examModulesLabel,
|
modules: examModulesLabel,
|
||||||
assigner: teacher.name,
|
assigner: teacher.name,
|
||||||
},
|
},
|
||||||
|
environment: process.env.ENVIRONMENT,
|
||||||
},
|
},
|
||||||
[assignee.email],
|
[assignee.email],
|
||||||
"EnCoach - New Assignment!",
|
"EnCoach - New Assignment!",
|
||||||
|
|||||||
@@ -113,6 +113,7 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
corporateName: invitedBy.name,
|
corporateName: invitedBy.name,
|
||||||
name: req.session.user.name,
|
name: req.session.user.name,
|
||||||
decision: "accept",
|
decision: "accept",
|
||||||
|
environment: process.env.ENVIRONMENT,
|
||||||
},
|
},
|
||||||
[invitedBy.email],
|
[invitedBy.email],
|
||||||
`${req.session.user.name} has accepted your invite!`,
|
`${req.session.user.name} has accepted your invite!`,
|
||||||
|
|||||||
@@ -1,17 +1,7 @@
|
|||||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||||
import type {NextApiRequest, NextApiResponse} from "next";
|
import type {NextApiRequest, NextApiResponse} from "next";
|
||||||
import {app} from "@/firebase";
|
import {app} from "@/firebase";
|
||||||
import {
|
import {getFirestore, getDoc, doc, deleteDoc, setDoc, getDocs, collection, where, query} from "firebase/firestore";
|
||||||
getFirestore,
|
|
||||||
getDoc,
|
|
||||||
doc,
|
|
||||||
deleteDoc,
|
|
||||||
setDoc,
|
|
||||||
getDocs,
|
|
||||||
collection,
|
|
||||||
where,
|
|
||||||
query,
|
|
||||||
} from "firebase/firestore";
|
|
||||||
import {withIronSessionApiRoute} from "iron-session/next";
|
import {withIronSessionApiRoute} from "iron-session/next";
|
||||||
import {sessionOptions} from "@/lib/session";
|
import {sessionOptions} from "@/lib/session";
|
||||||
import {Ticket} from "@/interfaces/ticket";
|
import {Ticket} from "@/interfaces/ticket";
|
||||||
@@ -41,8 +31,7 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
|
|
||||||
if (snapshot.exists()) {
|
if (snapshot.exists()) {
|
||||||
const invite = {...snapshot.data(), id: snapshot.id} as Invite;
|
const invite = {...snapshot.data(), id: snapshot.id} as Invite;
|
||||||
if (invite.to !== req.session.user.id)
|
if (invite.to !== req.session.user.id) return res.status(403).json({ok: false});
|
||||||
return res.status(403).json({ ok: false });
|
|
||||||
|
|
||||||
await deleteDoc(snapshot.ref);
|
await deleteDoc(snapshot.ref);
|
||||||
const invitedByRef = await getDoc(doc(db, "users", invite.from));
|
const invitedByRef = await getDoc(doc(db, "users", invite.from));
|
||||||
@@ -57,6 +46,7 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
corporateName: invitedBy.name,
|
corporateName: invitedBy.name,
|
||||||
name: req.session.user.name,
|
name: req.session.user.name,
|
||||||
decision: "decline",
|
decision: "decline",
|
||||||
|
environment: process.env.ENVIRONMENT,
|
||||||
},
|
},
|
||||||
[invitedBy.email],
|
[invitedBy.email],
|
||||||
`${req.session.user.name} has declined your invite!`,
|
`${req.session.user.name} has declined your invite!`,
|
||||||
|
|||||||
@@ -5,14 +5,7 @@ import { Invite } from "@/interfaces/invite";
|
|||||||
import {Ticket} from "@/interfaces/ticket";
|
import {Ticket} from "@/interfaces/ticket";
|
||||||
import {User} from "@/interfaces/user";
|
import {User} from "@/interfaces/user";
|
||||||
import {sessionOptions} from "@/lib/session";
|
import {sessionOptions} from "@/lib/session";
|
||||||
import {
|
import {collection, doc, getDoc, getDocs, getFirestore, setDoc} from "firebase/firestore";
|
||||||
collection,
|
|
||||||
doc,
|
|
||||||
getDoc,
|
|
||||||
getDocs,
|
|
||||||
getFirestore,
|
|
||||||
setDoc,
|
|
||||||
} from "firebase/firestore";
|
|
||||||
import {withIronSessionApiRoute} from "iron-session/next";
|
import {withIronSessionApiRoute} from "iron-session/next";
|
||||||
import type {NextApiRequest, NextApiResponse} from "next";
|
import type {NextApiRequest, NextApiResponse} from "next";
|
||||||
import ShortUniqueId from "short-unique-id";
|
import ShortUniqueId from "short-unique-id";
|
||||||
@@ -45,9 +38,7 @@ async function get(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
async function post(req: NextApiRequest, res: NextApiResponse) {
|
async function post(req: NextApiRequest, res: NextApiResponse) {
|
||||||
const body = req.body as Invite;
|
const body = req.body as Invite;
|
||||||
|
|
||||||
const existingInvites = (await getDocs(collection(db, "invites"))).docs.map(
|
const existingInvites = (await getDocs(collection(db, "invites"))).docs.map((x) => ({...x.data(), id: x.id})) as Invite[];
|
||||||
(x) => ({ ...x.data(), id: x.id }),
|
|
||||||
) as Invite[];
|
|
||||||
|
|
||||||
const invitedRef = await getDoc(doc(db, "users", body.to));
|
const invitedRef = await getDoc(doc(db, "users", body.to));
|
||||||
if (!invitedRef.exists()) return res.status(404).json({ok: false});
|
if (!invitedRef.exists()) return res.status(404).json({ok: false});
|
||||||
@@ -64,10 +55,8 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
{
|
{
|
||||||
name: invited.name,
|
name: invited.name,
|
||||||
corporateName:
|
corporateName:
|
||||||
invitedBy.type === "corporate"
|
invitedBy.type === "corporate" ? invitedBy.corporateInformation?.companyInformation?.name || invitedBy.name : invitedBy.name,
|
||||||
? invitedBy.corporateInformation?.companyInformation?.name ||
|
environment: process.env.ENVIRONMENT,
|
||||||
invitedBy.name
|
|
||||||
: invitedBy.name,
|
|
||||||
},
|
},
|
||||||
[invited.email],
|
[invited.email],
|
||||||
"You have been invited to a group!",
|
"You have been invited to a group!",
|
||||||
@@ -76,10 +65,7 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
console.log(e);
|
console.log(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (existingInvites.filter((i) => i.to === body.to && i.from === body.from).length == 0) {
|
||||||
existingInvites.filter((i) => i.to === body.to && i.from === body.from)
|
|
||||||
.length == 0
|
|
||||||
) {
|
|
||||||
const shortUID = new ShortUniqueId();
|
const shortUID = new ShortUniqueId();
|
||||||
await setDoc(doc(db, "invites", body.id || shortUID.randomUUID(8)), body);
|
await setDoc(doc(db, "invites", body.id || shortUID.randomUUID(8)), body);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ async function sendVerification(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
name: req.session.user.name,
|
name: req.session.user.name,
|
||||||
code: short.randomUUID(6),
|
code: short.randomUUID(6),
|
||||||
email: req.session.user.email,
|
email: req.session.user.email,
|
||||||
|
environment: process.env.ENVIRONMENT,
|
||||||
},
|
},
|
||||||
[req.session.user.email],
|
[req.session.user.email],
|
||||||
"EnCoach Verification",
|
"EnCoach Verification",
|
||||||
|
|||||||
@@ -1,13 +1,7 @@
|
|||||||
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
// Next.js API route support: https://nextjs.org/docs/api-routes/introduction
|
||||||
import type {NextApiRequest, NextApiResponse} from "next";
|
import type {NextApiRequest, NextApiResponse} from "next";
|
||||||
import {app} from "@/firebase";
|
import {app} from "@/firebase";
|
||||||
import {
|
import {getFirestore, getDoc, doc, deleteDoc, setDoc} from "firebase/firestore";
|
||||||
getFirestore,
|
|
||||||
getDoc,
|
|
||||||
doc,
|
|
||||||
deleteDoc,
|
|
||||||
setDoc,
|
|
||||||
} from "firebase/firestore";
|
|
||||||
import {withIronSessionApiRoute} from "iron-session/next";
|
import {withIronSessionApiRoute} from "iron-session/next";
|
||||||
import {sessionOptions} from "@/lib/session";
|
import {sessionOptions} from "@/lib/session";
|
||||||
import {Ticket, TicketTypeLabel, TicketStatusLabel} from "@/interfaces/ticket";
|
import {Ticket, TicketTypeLabel, TicketStatusLabel} from "@/interfaces/ticket";
|
||||||
@@ -81,7 +75,7 @@ async function patch(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
await setDoc(snapshot.ref, body, {merge: true});
|
await setDoc(snapshot.ref, body, {merge: true});
|
||||||
try {
|
try {
|
||||||
// send email if the status actually changed to completed
|
// send email if the status actually changed to completed
|
||||||
if(data.status !== req.body.status && req.body.status === 'completed') {
|
if (data.status !== req.body.status && req.body.status === "completed") {
|
||||||
await sendEmail(
|
await sendEmail(
|
||||||
"ticketStatusCompleted",
|
"ticketStatusCompleted",
|
||||||
{
|
{
|
||||||
@@ -92,6 +86,7 @@ async function patch(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
type: TicketTypeLabel[body.type],
|
type: TicketTypeLabel[body.type],
|
||||||
reportedFrom: body.reportedFrom,
|
reportedFrom: body.reportedFrom,
|
||||||
description: body.description,
|
description: body.description,
|
||||||
|
environment: process.env.ENVIRONMENT,
|
||||||
},
|
},
|
||||||
[data.reporter.email],
|
[data.reporter.email],
|
||||||
`Ticket ${id}: ${data.subject}`,
|
`Ticket ${id}: ${data.subject}`,
|
||||||
|
|||||||
@@ -3,15 +3,7 @@ import { sendEmail } from "@/email";
|
|||||||
import {app} from "@/firebase";
|
import {app} from "@/firebase";
|
||||||
import {Ticket, TicketTypeLabel, TicketWithCorporate} from "@/interfaces/ticket";
|
import {Ticket, TicketTypeLabel, TicketWithCorporate} from "@/interfaces/ticket";
|
||||||
import {sessionOptions} from "@/lib/session";
|
import {sessionOptions} from "@/lib/session";
|
||||||
import {
|
import {collection, doc, getDocs, getFirestore, setDoc, where, query} from "firebase/firestore";
|
||||||
collection,
|
|
||||||
doc,
|
|
||||||
getDocs,
|
|
||||||
getFirestore,
|
|
||||||
setDoc,
|
|
||||||
where,
|
|
||||||
query,
|
|
||||||
} from "firebase/firestore";
|
|
||||||
import {withIronSessionApiRoute} from "iron-session/next";
|
import {withIronSessionApiRoute} from "iron-session/next";
|
||||||
import moment from "moment";
|
import moment from "moment";
|
||||||
import type {NextApiRequest, NextApiResponse} from "next";
|
import type {NextApiRequest, NextApiResponse} from "next";
|
||||||
@@ -100,9 +92,10 @@ async function post(req: NextApiRequest, res: NextApiResponse) {
|
|||||||
type: TicketTypeLabel[body.type],
|
type: TicketTypeLabel[body.type],
|
||||||
reportedFrom: body.reportedFrom,
|
reportedFrom: body.reportedFrom,
|
||||||
description: body.description,
|
description: body.description,
|
||||||
|
environment: process.env.ENVIRONMENT,
|
||||||
},
|
},
|
||||||
[body.reporter.email],
|
[body.reporter.email],
|
||||||
`Ticket ${id}: ${body.subject}`
|
`Ticket ${id}: ${body.subject}`,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.log(e);
|
console.log(e);
|
||||||
|
|||||||
Reference in New Issue
Block a user