Skip to content

Commit

Permalink
Fix bug in async react component
Browse files Browse the repository at this point in the history
  • Loading branch information
alanhamlett committed Dec 5, 2024
1 parent 87d76c9 commit 6e55a43
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions src/components/NavBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,8 @@ import React from 'react';
import { useSelector } from 'react-redux';
import { ReduxSelector } from '../types/store';
import { User } from '../types/user';
import { getWebsiteUrl } from '../utils/settings';

export default async function NavBar(): Promise<Promise<JSX.Element>> {
export default function NavBar(): JSX.Element {
const user: User | undefined = useSelector(
(selector: ReduxSelector) => selector.currentUser.user,
);
Expand All @@ -21,9 +20,9 @@ export default async function NavBar(): Promise<Promise<JSX.Element>> {
}
};

const customRules = async () => {
const customRules = () => {
if (user) {
const url = await getWebsiteUrl();
const url = 'https://wakatime.com';
return (
<li className="mb-2">
<a
Expand All @@ -42,9 +41,9 @@ export default async function NavBar(): Promise<Promise<JSX.Element>> {
}
};

const dashboard = async () => {
const dashboard = () => {
if (user) {
const url = await getWebsiteUrl();
const url = 'https://wakatime.com';
return (
<li className="mb-2">
<a
Expand Down Expand Up @@ -87,8 +86,8 @@ export default async function NavBar(): Promise<Promise<JSX.Element>> {
<div className="collapse navbar-collapse mt-4" id="userInfoCollapse">
{signedInAs()}
<ul className="nav navbar-nav border-bottom pb-2">
{await customRules()}
{await dashboard()}
{customRules()}
{dashboard()}
<li className="dropdown">
<a
href="#"
Expand Down

0 comments on commit 6e55a43

Please sign in to comment.