From d664ddc9b84b25922239e3bbc253b35ea54f2533 Mon Sep 17 00:00:00 2001 From: Hassan Abouelela <47495861+HassanAbouelela@users.noreply.github.com> Date: Sun, 3 Jan 2021 05:47:07 +0300 Subject: Fixes Preexisting Linting Issues Fixes all errors, and most warnings generated by eslint. Most were fixed by eslint automatically such as indentation and quotes. Signed-off-by: Hassan Abouelela <47495861+HassanAbouelela@users.noreply.github.com> --- src/components/OAuth2Button.tsx | 66 ++++++++++++++++++++--------------------- 1 file changed, 33 insertions(+), 33 deletions(-) (limited to 'src/components/OAuth2Button.tsx') diff --git a/src/components/OAuth2Button.tsx b/src/components/OAuth2Button.tsx index c364369..4fa3f61 100644 --- a/src/components/OAuth2Button.tsx +++ b/src/components/OAuth2Button.tsx @@ -1,7 +1,7 @@ /** @jsx jsx */ import { css, jsx } from "@emotion/react"; -import { FontAwesomeIcon } from '@fortawesome/react-fontawesome'; +import { FontAwesomeIcon } from "@fortawesome/react-fontawesome"; import { faDiscord } from "@fortawesome/free-brands-svg-icons"; import colors from "../colors"; @@ -40,49 +40,49 @@ span { `; function doLogin(disableFunction: (newState: boolean) => void) { - disableFunction(true); + disableFunction(true); - const redirectURI = encodeURIComponent(document.location.protocol + "//" + document.location.host + "/callback"); + const redirectURI = encodeURIComponent(document.location.protocol + "//" + document.location.host + "/callback"); - const windowRef = window.open( - `https://discord.com/api/oauth2/authorize?client_id=${OAUTH2_CLIENT_ID}&response_type=code&scope=identify&redirect_uri=${redirectURI}&prompt=none`, - "Discord_OAuth2", - "height=700,width=500,location=no,menubar=no,resizable=no,status=no,titlebar=no,left=300,top=300" - ) + const windowRef = window.open( + `https://discord.com/api/oauth2/authorize?client_id=${OAUTH2_CLIENT_ID}&response_type=code&scope=identify&redirect_uri=${redirectURI}&prompt=none`, + "Discord_OAuth2", + "height=700,width=500,location=no,menubar=no,resizable=no,status=no,titlebar=no,left=300,top=300" + ); - const interval = setInterval(() => { - if (windowRef?.closed) { - clearInterval(interval); - disableFunction(false); - } - }, 500) + const interval = setInterval(() => { + if (windowRef?.closed) { + clearInterval(interval); + disableFunction(false); + } + }, 500); - window.onmessage = (code: MessageEvent) => { - if (code.data.source) { - // React DevTools has a habit of sending messages, ignore them. - return; - } + window.onmessage = (code: MessageEvent) => { + if (code.data.source) { + // React DevTools has a habit of sending messages, ignore them. + return; + } - if (code.isTrusted) { - windowRef?.close(); + if (code.isTrusted) { + windowRef?.close(); - console.log("Code received:", code.data); + console.log("Code received:", code.data); - disableFunction(false); - clearInterval(interval); + disableFunction(false); + clearInterval(interval); - window.onmessage = null; - } - }; + window.onmessage = null; + } + }; } -function OAuth2Button() { - const [disabled, setDisabled] = useState(false); +function OAuth2Button(): JSX.Element { + const [disabled, setDisabled] = useState(false); - return ; + return ; } export default OAuth2Button; -- cgit v1.2.3