Skip to content

Commit

Permalink
made recommeneded fixes for types in login and _app
Browse files Browse the repository at this point in the history
  • Loading branch information
jeromehardaway committed Nov 24, 2024
1 parent 6277830 commit 6eff66d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
10 changes: 5 additions & 5 deletions .prettierrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"endOfLine": "lf",
"semi": true,
"singleQuote": false,
"tabWidth": 4,
"trailingComma": "es5",
"printWidth": 80
}
"tabWidth": 4,
"semi": true,
"printWidth": 100,
"endOfLine": "lf"
}
4 changes: 2 additions & 2 deletions src/pages/_app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ interface CustomAppProps extends Omit<AppProps, "Component"> {
const MyApp = ({ Component, pageProps }: CustomAppProps): JSX.Element => {
const router = useRouter();
const Layout = Component.Layout || FallbackLayout;
const layoutProps = pageProps.layout || {};
const { layout } = pageProps;
const layoutProps = layout || {};

useEffect(() => {
// Replace the expression with a more explicit check and action
const activeElement = document.activeElement;
if (activeElement instanceof HTMLElement) {
activeElement.blur();
Expand Down
3 changes: 0 additions & 3 deletions src/pages/login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,10 @@ const Login: PageWithLayout = () => {

useEffect(() => {
if (status === "authenticated") {
// Using async/await with proper error handling
(async () => {
try {
await router.push("/profile");
} catch (err) {
// Only log in development, consider using a proper error tracking service
if (process.env.NODE_ENV === "development") {
// eslint-disable-next-line no-console
console.error("Failed to redirect to profile:", err);
Expand All @@ -47,7 +45,6 @@ const Login: PageWithLayout = () => {
redirect: true,
});
} catch (error) {
// Handle sign-in error if needed
if (process.env.NODE_ENV === "development") {
// eslint-disable-next-line no-console
console.error("Sign-in failed:", error);
Expand Down

0 comments on commit 6eff66d

Please sign in to comment.