Add eslint rule and fix as many issues as possible

This commit is contained in:
Khoa Le
2023-06-19 23:42:04 -04:00
parent e9eacc445d
commit 9d33e4756b
689 changed files with 9446 additions and 21821 deletions
@@ -1,26 +1,26 @@
import { useEffect, useState } from 'react';
import { useEffect, useState } from "react";
import { useNotificationContext } from '@app/components/context/Notifications/NotificationProvider';
import { Checkbox, EmailServiceSetupModal } from '@app/components/v2';
import { useFetchServerStatus } from '@app/hooks/api/serverDetails';
import { usePopUp } from '@app/hooks/usePopUp';
import { useNotificationContext } from "@app/components/context/Notifications/NotificationProvider";
import { Checkbox, EmailServiceSetupModal } from "@app/components/v2";
import { useFetchServerStatus } from "@app/hooks/api/serverDetails";
import { usePopUp } from "@app/hooks/usePopUp";
import { useGetUser } from '../../../../hooks/api';
import { User } from '../../../../hooks/api/types';
import updateMyMfaEnabled from '../../../../pages/api/user/updateMyMfaEnabled';
import { useGetUser } from "../../../../hooks/api";
import { User } from "../../../../hooks/api/types";
import updateMyMfaEnabled from "../../../../pages/api/user/updateMyMfaEnabled";
export const SecuritySection = () => {
const [isMfaEnabled, setIsMfaEnabled] = useState(false);
const { data: user } = useGetUser();
const { createNotification } = useNotificationContext();
const { handlePopUpToggle, popUp, handlePopUpOpen } = usePopUp([
'setUpEmail'
"setUpEmail"
] as const);
const {data: serverDetails } = useFetchServerStatus()
useEffect(() => {
if (user && typeof user.isMfaEnabled !== 'undefined') {
if (user && typeof user.isMfaEnabled !== "undefined") {
setIsMfaEnabled(user.isMfaEnabled);
}
}, [user]);
@@ -36,13 +36,13 @@ export const SecuritySection = () => {
}
createNotification({
text: `${newUser.isMfaEnabled ? 'Successfully turned on two-factor authentication.' : 'Successfully turned off two-factor authentication.'}`,
type: 'success'
text: `${newUser.isMfaEnabled ? "Successfully turned on two-factor authentication." : "Successfully turned off two-factor authentication."}`,
type: "success"
});
} catch (err) {
createNotification({
text: 'Something went wrong while toggling the two-factor authentication.',
type: 'error'
text: "Something went wrong while toggling the two-factor authentication.",
type: "error"
});
console.error(err);
}
@@ -63,7 +63,7 @@ export const SecuritySection = () => {
if (serverDetails?.emailConfigured){
toggleMfa(state as boolean);
} else {
handlePopUpOpen('setUpEmail');
handlePopUpOpen("setUpEmail");
}
}}
>
@@ -73,7 +73,7 @@ export const SecuritySection = () => {
</form>
<EmailServiceSetupModal
isOpen={popUp.setUpEmail?.isOpen}
onOpenChange={(isOpen) => handlePopUpToggle('setUpEmail', isOpen)}
onOpenChange={(isOpen) => handlePopUpToggle("setUpEmail", isOpen)}
/>
</>
);
@@ -1 +1 @@
export { SecuritySection } from './SecuritySection';
export { SecuritySection } from "./SecuritySection";