diff --git a/apps/dashboard/app/security/email/add/page.tsx b/apps/dashboard/app/security/email/add/page.tsx
index 4152d48f626..d4e4aefb5fe 100644
--- a/apps/dashboard/app/security/email/add/page.tsx
+++ b/apps/dashboard/app/security/email/add/page.tsx
@@ -1,14 +1,15 @@
-"use client";
-import { getServerSession } from "next-auth";
-import { authOptions } from "../../../api/auth/[...nextauth]/route";
-import ContentContainer from "@/components/content-container";
-import ArrowForwardIcon from "@mui/icons-material/ArrowForward";
+"use client"
-// @ts-ignore-next-line no-implicit-any error
-import { experimental_useFormStatus as useFormStatus } from "react-dom";
-// @ts-ignore-next-line no-implicit-any error
-import { experimental_useFormState as useFormState } from "react-dom";
-import { emailRegisterInitiateServerAction } from "../../server-actions";
+import ArrowForwardIcon from "@mui/icons-material/ArrowForward"
+
+import {
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore-next-line no-implicit-any error
+ experimental_useFormStatus as useFormStatus,
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore-next-line no-implicit-any error
+ experimental_useFormState as useFormState,
+} from "react-dom"
import {
Box,
@@ -19,18 +20,19 @@ import {
FormHelperText,
Card,
Typography,
- Link as MuiLink,
-} from "@mui/joy";
-import InfoOutlined from "@mui/icons-material/InfoOutlined";
-import { CheckBox } from "@mui/icons-material";
-import Link from "next/link";
+} from "@mui/joy"
+import InfoOutlined from "@mui/icons-material/InfoOutlined"
+import Link from "next/link"
+
+import { emailRegisterInitiateServerAction } from "../../server-actions"
+
export default function AddEmail() {
const [state, formAction] = useFormState(emailRegisterInitiateServerAction, {
error: null,
message: null,
responsePayload: {},
- });
- const { pending } = useFormStatus();
+ })
+ const { pending } = useFormStatus()
return (
- Opps! something is wrong.
+ Oops! something is wrong.
) : null}
@@ -103,5 +105,5 @@ export default function AddEmail() {
- );
+ )
}
diff --git a/apps/dashboard/app/security/email/verify/page.tsx b/apps/dashboard/app/security/email/verify/page.tsx
index 11d5059ffdd..96f6ad60c39 100644
--- a/apps/dashboard/app/security/email/verify/page.tsx
+++ b/apps/dashboard/app/security/email/verify/page.tsx
@@ -1,57 +1,53 @@
-import { authOptions } from "@/app/api/auth/[...nextauth]/route";
-import VerfiyEmailForm from "./verify-form";
-import { getServerSession } from "next-auth";
-import { redirect } from "next/navigation";
+import { getServerSession } from "next-auth"
+import { redirect } from "next/navigation"
+
+import VerifyEmailForm from "./verify-form"
+
import {
deleteEmail,
emailRegistrationInitiate,
-} from "@/services/graphql/mutations/email";
-import { useFormStatus } from "react-dom";
+} from "@/services/graphql/mutations/email"
+import { authOptions } from "@/app/api/auth/[...nextauth]/route"
type VerifyEmailProp = {
- emailRegistrationId: string | null | undefined;
-};
+ emailRegistrationId: string | null | undefined
+}
export default async function VerifyEmail({
searchParams,
}: {
- searchParams: VerifyEmailProp;
+ searchParams: VerifyEmailProp
}) {
- let { emailRegistrationId } = searchParams;
- const session = await getServerSession(authOptions);
- const token = session?.accessToken;
+ let { emailRegistrationId } = searchParams
+ const session = await getServerSession(authOptions)
+ const token = session?.accessToken
// this is if user has address but not verified
if (!emailRegistrationId || typeof emailRegistrationId !== "string") {
- const email = session?.userData.data.me?.email?.address;
+ const email = session?.userData.data.me?.email?.address
if (!email || typeof email !== "string" || !token) {
- redirect("/security");
+ redirect("/security")
}
- await deleteEmail(token);
- let data;
+ await deleteEmail(token)
+ let data
try {
- data = await emailRegistrationInitiate(email, token);
+ data = await emailRegistrationInitiate(email, token)
} catch (err) {
- console.log("error in emailRegistrationInitiate ", err);
- redirect("/security");
+ console.log("error in emailRegistrationInitiate ", err)
+ redirect("/security")
}
if (data?.userEmailRegistrationInitiate.errors.length) {
- redirect("/security");
+ redirect("/security")
}
- emailRegistrationId =
- data?.userEmailRegistrationInitiate.emailRegistrationId;
+ emailRegistrationId = data?.userEmailRegistrationInitiate.emailRegistrationId
}
if (!emailRegistrationId && typeof emailRegistrationId !== "string") {
- redirect("/security");
+ redirect("/security")
}
- return (
-
- );
+ return
}
diff --git a/apps/dashboard/app/security/email/verify/verify-form.tsx b/apps/dashboard/app/security/email/verify/verify-form.tsx
index 18421688e64..4e973abfb9b 100644
--- a/apps/dashboard/app/security/email/verify/verify-form.tsx
+++ b/apps/dashboard/app/security/email/verify/verify-form.tsx
@@ -1,13 +1,14 @@
-"use client";
-import { getServerSession } from "next-auth";
-import { authOptions } from "../../../api/auth/[...nextauth]/route";
-import ContentContainer from "@/components/content-container";
-import ArrowForwardIcon from "@mui/icons-material/ArrowForward";
-// @ts-ignore-next-line no-implicit-any error
-import { experimental_useFormStatus as useFormStatus } from "react-dom";
-// @ts-ignore-next-line no-implicit-any error
-import { experimental_useFormState as useFormState } from "react-dom";
-import { emailRegisterValidateServerAction } from "../../server-actions";
+"use client"
+
+import ArrowForwardIcon from "@mui/icons-material/ArrowForward"
+import {
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore-next-line no-implicit-any error
+ experimental_useFormStatus as useFormStatus,
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
+ // @ts-ignore-next-line no-implicit-any error
+ experimental_useFormState as useFormState,
+} from "react-dom"
import {
Box,
@@ -18,24 +19,23 @@ import {
FormHelperText,
Card,
Typography,
-} from "@mui/joy";
-import InfoOutlined from "@mui/icons-material/InfoOutlined";
-import { CheckBox } from "@mui/icons-material";
-import Link from "next/link";
+} from "@mui/joy"
+import InfoOutlined from "@mui/icons-material/InfoOutlined"
+import Link from "next/link"
+
+import { emailRegisterValidateServerAction } from "../../server-actions"
type VerifyEmailFormProps = {
- emailRegistrationId: string;
-};
-export default function VerifyEmailForm({
- emailRegistrationId,
-}: VerifyEmailFormProps) {
- const { pending } = useFormStatus();
+ emailRegistrationId: string
+}
+export default function VerifyEmailForm({ emailRegistrationId }: VerifyEmailFormProps) {
+ const { pending } = useFormStatus()
const [state, formAction] = useFormState(emailRegisterValidateServerAction, {
error: null,
message: null,
responsePayload: {},
- });
+ })
return (
- );
+ )
}
diff --git a/apps/dashboard/app/security/page.tsx b/apps/dashboard/app/security/page.tsx
index 58cb9282709..8b141074739 100644
--- a/apps/dashboard/app/security/page.tsx
+++ b/apps/dashboard/app/security/page.tsx
@@ -1,13 +1,13 @@
-import { getServerSession } from "next-auth";
-import { authOptions } from "@/app/api/auth/[...nextauth]/route";
-import ContentContainer from "@/components/content-container";
-import EmailSettings from "@/components/security/email/email";
-import { Box } from "@mui/joy";
+import { getServerSession } from "next-auth"
+import { Box } from "@mui/joy"
+
+import { authOptions } from "@/app/api/auth/[...nextauth]/route"
+import ContentContainer from "@/components/content-container"
+import EmailSettings from "@/components/security/email/email"
export default async function Home() {
- const session = await getServerSession(authOptions);
- const totpEnabled = session?.userData.data.me?.totpEnabled;
- const email = session?.userData.data.me?.email;
+ const session = await getServerSession(authOptions)
+ const email = session?.userData.data.me?.email
return (
: null}
- );
+ )
}
diff --git a/apps/dashboard/app/security/server-actions.ts b/apps/dashboard/app/security/server-actions.ts
index 5b1a9ca4a4b..77d88c6f117 100644
--- a/apps/dashboard/app/security/server-actions.ts
+++ b/apps/dashboard/app/security/server-actions.ts
@@ -1,50 +1,47 @@
-"use server";
-import { authOptions } from "@/app/api/auth/[...nextauth]/route";
+"use server"
+import { getServerSession } from "next-auth"
+import { redirect } from "next/navigation"
+
import {
- deleteEmail,
emailRegistrationInitiate,
emailRegistrationValidate,
-} from "@/services/graphql/mutations/email";
-import { from } from "@apollo/client";
-import { getServerSession } from "next-auth";
-import { revalidatePath } from "next/cache";
-import { redirect } from "next/navigation";
-import { useFormState } from "react-dom";
+} from "@/services/graphql/mutations/email"
+import { authOptions } from "@/app/api/auth/[...nextauth]/route"
export const emailRegisterInitiateServerAction = async (
_prevState: unknown,
- form: FormData
+ form: FormData,
) => {
- const email = form.get("email");
+ const email = form.get("email")
if (!email || typeof email !== "string") {
return {
error: true,
message: "Invalid Email",
data: null,
- };
+ }
}
- const session = await getServerSession(authOptions);
- const token = session?.accessToken;
+ const session = await getServerSession(authOptions)
+ const token = session?.accessToken
if (!token && typeof token !== "string") {
return {
error: true,
message: "Invalid Token",
data: null,
- };
+ }
}
- let data;
+ let data
try {
- data = await emailRegistrationInitiate(email, token);
+ data = await emailRegistrationInitiate(email, token)
} catch (err) {
- console.log("error in emailRegistrationInitiate ", err);
+ console.log("error in emailRegistrationInitiate ", err)
return {
error: true,
message:
"Something went wrong Please try again and if error persist contact support",
data: null,
- };
+ }
}
if (data?.userEmailRegistrationInitiate.errors.length) {
@@ -52,20 +49,19 @@ export const emailRegisterInitiateServerAction = async (
error: true,
message: data?.userEmailRegistrationInitiate.errors[0],
data: null,
- };
+ }
}
- const emailRegistrationId =
- data?.userEmailRegistrationInitiate.emailRegistrationId;
- redirect(`/security/email/verify?emailRegistrationId=${emailRegistrationId}`);
-};
+ const emailRegistrationId = data?.userEmailRegistrationInitiate.emailRegistrationId
+ redirect(`/security/email/verify?emailRegistrationId=${emailRegistrationId}`)
+}
export const emailRegisterValidateServerAction = async (
_prevState: unknown,
- form: FormData
+ form: FormData,
) => {
- const code = form.get("code");
- const emailRegistrationId = form.get("emailRegistrationId");
+ const code = form.get("code")
+ const emailRegistrationId = form.get("emailRegistrationId")
if (
!code ||
@@ -77,45 +73,44 @@ export const emailRegisterValidateServerAction = async (
error: true,
message: "Invalid values",
data: null,
- };
+ }
}
- const session = await getServerSession(authOptions);
- const token = session?.accessToken;
+ const session = await getServerSession(authOptions)
+ const token = session?.accessToken
if (!token || typeof token !== "string") {
return {
error: true,
message: "Invalid Token",
data: null,
- };
+ }
}
- let codeVerificationResponse;
+ let codeVerificationResponse
try {
codeVerificationResponse = await emailRegistrationValidate(
code,
emailRegistrationId,
- token
- );
+ token,
+ )
} catch (err) {
- console.log("error in emailRegistrationValidate ", err);
+ console.log("error in emailRegistrationValidate ", err)
return {
error: true,
message:
"Something went wrong Please try again and if error persist contact support",
data: null,
- };
+ }
}
-
+
if (codeVerificationResponse?.userEmailRegistrationValidate.errors.length) {
return {
error: true,
- message:
- codeVerificationResponse?.userEmailRegistrationValidate.errors[0],
+ message: codeVerificationResponse?.userEmailRegistrationValidate.errors[0],
data: null,
- };
+ }
}
- redirect("/security");
-};
+ redirect("/security")
+}
diff --git a/apps/dashboard/app/url.ts b/apps/dashboard/app/url.ts
index 70095560e50..bb7e6b725e6 100644
--- a/apps/dashboard/app/url.ts
+++ b/apps/dashboard/app/url.ts
@@ -9,5 +9,4 @@ export const URLS: Record = {
"/security": { title: "Security", protected: true },
"/security/email/add": { title: "Add Email", protected: true },
"/security/email/verify": { title: "Verify Email", protected: true },
-
-};
+}
diff --git a/apps/dashboard/components/security/email/email.tsx b/apps/dashboard/components/security/email/email.tsx
index 3eb95939652..2c19bdd28ca 100644
--- a/apps/dashboard/components/security/email/email.tsx
+++ b/apps/dashboard/components/security/email/email.tsx
@@ -1,20 +1,18 @@
-
"use client"
-import { Button, Typography, Card } from "@mui/joy";
-import { Box } from "@mui/joy";
-import MailOutlineIcon from "@mui/icons-material/MailOutline";
-import DeleteIcon from "@mui/icons-material/Delete";
-import Link from "next/link";
+import { Button, Typography, Box } from "@mui/joy"
+import MailOutlineIcon from "@mui/icons-material/MailOutline"
+import DeleteIcon from "@mui/icons-material/Delete"
+import Link from "next/link"
type EmailDataProps = {
- readonly __typename: "Email";
- readonly address?: string | null | undefined;
- readonly verified?: boolean | null | undefined;
-};
+ readonly __typename: "Email"
+ readonly address?: string | null | undefined
+ readonly verified?: boolean | null | undefined
+}
type EmailSettingsProps = {
- emailData: EmailDataProps;
-};
+ emailData: EmailDataProps
+}
function EmailSettings({ emailData }: EmailSettingsProps) {
return (
@@ -87,7 +85,7 @@ function EmailSettings({ emailData }: EmailSettingsProps) {
)}
- );
+ )
}
-export default EmailSettings;
+export default EmailSettings
diff --git a/apps/dashboard/components/side-bar/index.tsx b/apps/dashboard/components/side-bar/index.tsx
index d763ac68134..40e3b11aafe 100644
--- a/apps/dashboard/components/side-bar/index.tsx
+++ b/apps/dashboard/components/side-bar/index.tsx
@@ -1,21 +1,22 @@
-"use client";
-import React from "react";
-import Box from "@mui/joy/Box";
-import List from "@mui/joy/List";
-import Sheet from "@mui/joy/Sheet";
-import Divider from "@mui/material/Divider";
-import ReceiptLongIcon from "@mui/icons-material/ReceiptLong";
-import HomeOutlinedIcon from "@mui/icons-material/HomeOutlined";
-import { usePathname } from "next/navigation";
-import Logo from "./../logo";
-import { SidebarStyles } from "./side-bar-style";
-import { SidebarOverlay } from "./side-bar-overlay";
-import { NavigationLink } from "./navigation-links";
-import SecurityIcon from "@mui/icons-material/Security";
+"use client"
+import React from "react"
+import Box from "@mui/joy/Box"
+import List from "@mui/joy/List"
+import Sheet from "@mui/joy/Sheet"
+import Divider from "@mui/material/Divider"
+import ReceiptLongIcon from "@mui/icons-material/ReceiptLong"
+import HomeOutlinedIcon from "@mui/icons-material/HomeOutlined"
+import { usePathname } from "next/navigation"
+import SecurityIcon from "@mui/icons-material/Security"
+
+import Logo from "./../logo"
+import { SidebarStyles } from "./side-bar-style"
+import { SidebarOverlay } from "./side-bar-overlay"
+import { NavigationLink } from "./navigation-links"
const Sidebar: React.FC = () => {
- const path = usePathname();
- const isCurrentPath = (href: string): boolean => path === href;
+ const path = usePathname()
+ const isCurrentPath = (href: string): boolean => path === href
return (
{
- );
-};
+ )
+}
-export default Sidebar;
+export default Sidebar
diff --git a/apps/dashboard/components/side-bar/navigation-links.tsx b/apps/dashboard/components/side-bar/navigation-links.tsx
index 96b3620763c..cadfe36b1dd 100644
--- a/apps/dashboard/components/side-bar/navigation-links.tsx
+++ b/apps/dashboard/components/side-bar/navigation-links.tsx
@@ -1,15 +1,16 @@
-import React from "react";
-import Link from "next/link";
-import ListItem from "@mui/joy/ListItem";
-import ListItemButton from "@mui/joy/ListItemButton";
-import { Typography } from "@mui/joy";
-import { closeSidebar } from "./../utils";
+import React from "react"
+import Link from "next/link"
+import ListItem from "@mui/joy/ListItem"
+import ListItemButton from "@mui/joy/ListItemButton"
+import { Typography } from "@mui/joy"
+
+import { closeSidebar } from "./../utils"
interface NavigationLinkProps {
- href: string;
- icon: React.ReactElement;
- label: string;
- isCurrentPath: (href: string) => boolean;
+ href: string
+ icon: React.ReactElement
+ label: string
+ isCurrentPath: (href: string) => boolean
}
export const NavigationLink: React.FC = ({
@@ -22,12 +23,10 @@ export const NavigationLink: React.FC = ({
{
- closeSidebar();
+ closeSidebar()
}}
sx={{
- backgroundColor: isCurrentPath(href)
- ? "rgba(0, 0, 0, 0.08)"
- : "transparent",
+ "backgroundColor": isCurrentPath(href) ? "rgba(0, 0, 0, 0.08)" : "transparent",
"&:hover": {
backgroundColor: "rgba(0, 0, 0, 0.08)",
},
@@ -47,4 +46,4 @@ export const NavigationLink: React.FC = ({
-);
+)
diff --git a/apps/dashboard/components/side-bar/side-bar-overlay.tsx b/apps/dashboard/components/side-bar/side-bar-overlay.tsx
index e5b3a0253f2..318e0f5b261 100644
--- a/apps/dashboard/components/side-bar/side-bar-overlay.tsx
+++ b/apps/dashboard/components/side-bar/side-bar-overlay.tsx
@@ -1,6 +1,7 @@
-import React from "react";
-import Box from "@mui/joy/Box";
-import { closeSidebar } from "./../utils";
+import React from "react"
+import Box from "@mui/joy/Box"
+
+import { closeSidebar } from "./../utils"
export const SidebarOverlay: React.FC = () => (
(
}}
onClick={() => closeSidebar()}
/>
-);
+)
diff --git a/apps/dashboard/components/side-bar/side-bar-style.tsx b/apps/dashboard/components/side-bar/side-bar-style.tsx
index 3026545e72f..8e56f523ee8 100644
--- a/apps/dashboard/components/side-bar/side-bar-style.tsx
+++ b/apps/dashboard/components/side-bar/side-bar-style.tsx
@@ -1,5 +1,5 @@
-import React from "react";
-import GlobalStyles from "@mui/joy/GlobalStyles";
+import React from "react"
+import GlobalStyles from "@mui/joy/GlobalStyles"
export const SidebarStyles: React.FC = () => (
(
},
})}
/>
-);
+)
diff --git a/apps/dashboard/services/graphql/mutations/email.ts b/apps/dashboard/services/graphql/mutations/email.ts
index 2f9dec303c1..985c34d9839 100644
--- a/apps/dashboard/services/graphql/mutations/email.ts
+++ b/apps/dashboard/services/graphql/mutations/email.ts
@@ -1,19 +1,17 @@
-import { gql } from "@apollo/client";
-import { apollo } from "..";
+import { gql } from "@apollo/client"
+
+import { apollo } from ".."
import {
UserEmailDeleteDocument,
UserEmailDeleteMutation,
UserEmailRegistrationInitiateDocument,
UserEmailRegistrationInitiateMutation,
UserEmailRegistrationValidateDocument,
- UserEmailRegistrationValidateInput,
UserEmailRegistrationValidateMutation,
-} from "../generated";
+} from "../generated"
gql`
- mutation UserEmailRegistrationInitiate(
- $input: UserEmailRegistrationInitiateInput!
- ) {
+ mutation UserEmailRegistrationInitiate($input: UserEmailRegistrationInitiateInput!) {
userEmailRegistrationInitiate(input: $input) {
emailRegistrationId
errors {
@@ -22,12 +20,10 @@ gql`
}
}
}
-`;
+`
gql`
- mutation UserEmailRegistrationValidate(
- $input: UserEmailRegistrationValidateInput!
- ) {
+ mutation UserEmailRegistrationValidate($input: UserEmailRegistrationValidateInput!) {
userEmailRegistrationValidate(input: $input) {
errors {
message
@@ -35,7 +31,7 @@ gql`
}
}
}
-`;
+`
gql`
mutation UserEmailDelete {
@@ -46,62 +42,54 @@ gql`
}
}
}
-`;
+`
export async function emailRegistrationInitiate(email: string, token: string) {
- const client = apollo(token).getClient();
+ const client = apollo(token).getClient()
try {
- const { data } = await client.mutate(
- {
- mutation: UserEmailRegistrationInitiateDocument,
- variables: { input: { email } },
- }
- );
- return data;
+ const { data } = await client.mutate({
+ mutation: UserEmailRegistrationInitiateDocument,
+ variables: { input: { email } },
+ })
+ return data
} catch (error) {
- console.error("Error executing mutation: emailRegistrationInitiate ==> ", error);
- throw new Error("Error in emailRegistrationInitiate");
+ console.error("Error executing mutation: emailRegistrationInitiate ==> ", error)
+ throw new Error("Error in emailRegistrationInitiate")
}
}
export async function emailRegistrationValidate(
code: string,
emailRegistrationId: string,
- token: string
+ token: string,
) {
- const client = apollo(token).getClient();
+ const client = apollo(token).getClient()
try {
- const { data } = await client.mutate(
- {
- mutation: UserEmailRegistrationValidateDocument,
- variables: {
- input: {
- code,
- emailRegistrationId,
- },
+ const { data } = await client.mutate({
+ mutation: UserEmailRegistrationValidateDocument,
+ variables: {
+ input: {
+ code,
+ emailRegistrationId,
},
- }
- );
- return data;
+ },
+ })
+ return data
} catch (error) {
- console.error(
- "Error executing mutation: UserTotpRegistrationValidate ==> ",
- error
- );
- throw new Error("Error in UserTotpRegistrationValidate");
+ console.error("Error executing mutation: UserTotpRegistrationValidate ==> ", error)
+ throw new Error("Error in UserTotpRegistrationValidate")
}
}
export async function deleteEmail(token: string) {
- const client = apollo(token).getClient();
+ const client = apollo(token).getClient()
try {
- let errorMessages;
const { data } = await client.mutate({
mutation: UserEmailDeleteDocument,
- });
- return data;
+ })
+ return data
} catch (error) {
- console.error("Error executing userEmailDelete mutation:", error);
- throw new Error("Error in userEmailDelete");
+ console.error("Error executing userEmailDelete mutation:", error)
+ throw new Error("Error in userEmailDelete")
}
}
diff --git a/apps/dashboard/theme/theme.ts b/apps/dashboard/theme/theme.ts
index 0e5462952d7..6c53576d9f6 100644
--- a/apps/dashboard/theme/theme.ts
+++ b/apps/dashboard/theme/theme.ts
@@ -11,6 +11,6 @@ const theme = extendTheme({
display: inter.style.fontFamily,
code: inter.style.fontFamily,
},
-});
+})
export default theme