diff --git a/src/components/Account.jsx b/src/components/Account.jsx index 231602f..f3c2c67 100644 --- a/src/components/Account.jsx +++ b/src/components/Account.jsx @@ -178,7 +178,7 @@ const Account = () => {

One more step...

-

Insert your Clockify API here

+

Insert your Clockify API here

{ const [projectsDone, setProjectsDone] = useState(false) const [loading, setLoading] = useState(true) + const [apiAvailable, setApiAvailable] = useState(false) const getApiKey = async () => { @@ -30,12 +31,10 @@ const ClockifyTasksDisplay = (props) => { const dataSnap = await getDoc(reference) const result = await dataSnap.data() - - - if (result.keyClockify) { - + + setApiAvailable(true) await generateArrayOfWorkspaces(result.keyClockify) } @@ -70,7 +69,6 @@ const ClockifyTasksDisplay = (props) => { const getApiKeyReturn = key - const data = await makeRequestWorkspaces(key) @@ -166,7 +164,8 @@ const ClockifyTasksDisplay = (props) => { props.setProjectID(e) } - if (loading && userUID) { + if (loading && userUID !== '' && apiAvailable) { + return (
@@ -175,6 +174,10 @@ const ClockifyTasksDisplay = (props) => { } + if (!apiAvailable) { + return (
) + } + return ( <> { diff --git a/src/components/Identify.jsx b/src/components/Identify.jsx index 8540929..0fa75d0 100644 --- a/src/components/Identify.jsx +++ b/src/components/Identify.jsx @@ -38,6 +38,7 @@ const Identify = (props) => { const uid = response.user.uid addNewUserToFirebase(uid) + props.history.push('/config-account') } catch (error) {