Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): Eliminating signup page error #6471

Merged
merged 3 commits into from
Aug 1, 2022
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
import { AxiosError, AxiosResponse } from 'axios';
import { CookieStorage } from 'cookie-storage';
import { UserProfile } from 'Models';
import React, { useEffect, useState } from 'react';
import React, { useState } from 'react';
import { useHistory } from 'react-router-dom';
import appState from '../../AppState';
import { getLoggedInUserPermissions } from '../../axiosAPIs/miscAPI';
import { getTeams } from '../../axiosAPIs/teamsAPI';
import { createUser } from '../../axiosAPIs/userAPI';
import { Button } from '../../components/buttons/Button/Button';
import PageContainer from '../../components/containers/PageContainer';
Expand All @@ -43,14 +42,9 @@ const Signup = () => {
name: getNameFromEmail(appState.newUser.email),
email: appState.newUser.email || '',
});
const [countTeams, setCountTeams] = useState<number>(0);

const history = useHistory();

const setTeamCount = (count = 0) => {
setCountTeams(count);
};

const getUserPermissions = () => {
getLoggedInUserPermissions()
.then((res: AxiosResponse) => {
Expand Down Expand Up @@ -118,24 +112,6 @@ const Signup = () => {
}
};

useEffect(() => {
getTeams('', 0)
.then((res) => {
if (res.data) {
setTeamCount(res.data.paging?.total || 0);
} else {
throw jsonData['api-error-messages']['unexpected-server-response'];
}
})
.catch((err: AxiosError) => {
showErrorToast(
err,
jsonData['api-error-messages']['unexpected-server-response']
);
setTeamCount(0);
});
}, []);

return (
<>
{!loading && (
Expand Down Expand Up @@ -224,24 +200,6 @@ const Signup = () => {
filterJoinable
onSelectionChange={setSelectedTeams}
/>

{countTeams === 0 ? (
<div
className="tw-notification tw-bg-info tw-mt-2 tw-justify-start tw-w-full tw-p-2"
data-testid="toast">
<div className="tw-font-semibold tw-flex-shrink-0">
<SVGIcons
alt="info"
icon="info"
title="Info"
width="16px"
/>
</div>
<div className="tw-font-semibold tw-px-1">
There is no team available.
</div>
</div>
) : null}
aniketkatkar97 marked this conversation as resolved.
Show resolved Hide resolved
</div>
<div className="tw-flex tw-my-7 tw-justify-end">
<Button
Expand Down