Fix react async component
This commit is contained in:
@@ -1,12 +1,12 @@
|
|||||||
|
import React from 'react';
|
||||||
|
|
||||||
import { useDispatch, useSelector } from 'react-redux';
|
import { useDispatch, useSelector } from 'react-redux';
|
||||||
|
|
||||||
import React from 'react';
|
|
||||||
import { configLogout, setLoggingEnabled } from '../reducers/configReducer';
|
import { configLogout, setLoggingEnabled } from '../reducers/configReducer';
|
||||||
import { userLogout } from '../reducers/currentUser';
|
|
||||||
import { ReduxSelector } from '../types/store';
|
import { ReduxSelector } from '../types/store';
|
||||||
import { User } from '../types/user';
|
import { User } from '../types/user';
|
||||||
import changeExtensionState from '../utils/changeExtensionStatus';
|
import changeExtensionState from '../utils/changeExtensionStatus';
|
||||||
import { getWebsiteUrl } from '../utils/settings';
|
import { userLogout } from '../reducers/currentUser';
|
||||||
|
|
||||||
export interface MainListProps {
|
export interface MainListProps {
|
||||||
loggingEnabled: boolean;
|
loggingEnabled: boolean;
|
||||||
@@ -16,10 +16,10 @@ const openOptionsPage = async (): Promise<void> => {
|
|||||||
await browser.runtime.openOptionsPage();
|
await browser.runtime.openOptionsPage();
|
||||||
};
|
};
|
||||||
|
|
||||||
export default async function MainList({
|
export default function MainList({
|
||||||
loggingEnabled,
|
loggingEnabled,
|
||||||
totalTimeLoggedToday,
|
totalTimeLoggedToday,
|
||||||
}: MainListProps): Promise<JSX.Element> {
|
}: MainListProps): JSX.Element {
|
||||||
const dispatch = useDispatch();
|
const dispatch = useDispatch();
|
||||||
|
|
||||||
const user: User | undefined = useSelector(
|
const user: User | undefined = useSelector(
|
||||||
@@ -54,8 +54,6 @@ export default async function MainList({
|
|||||||
</div>
|
</div>
|
||||||
) : null;
|
) : null;
|
||||||
|
|
||||||
const url = await getWebsiteUrl();
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<div>
|
<div>
|
||||||
{user ? (
|
{user ? (
|
||||||
@@ -122,7 +120,7 @@ export default async function MainList({
|
|||||||
<a
|
<a
|
||||||
target="_blank"
|
target="_blank"
|
||||||
rel="noreferrer"
|
rel="noreferrer"
|
||||||
href={`${url}/login`}
|
href="https://wakatime.com/login"
|
||||||
className="list-group-item text-body-secondary"
|
className="list-group-item text-body-secondary"
|
||||||
>
|
>
|
||||||
<i className="fa fa-fw fa-sign-in me-2" />
|
<i className="fa fa-fw fa-sign-in me-2" />
|
||||||
|
|||||||
Reference in New Issue
Block a user