integration with backend done

This commit is contained in:
AyushRanjan
2023-09-13 10:47:00 +05:30
parent 02ccba2b1e
commit 82a1b47475
2 changed files with 6 additions and 32 deletions

View File

@@ -19,36 +19,6 @@ import MembersDetails from '@src/components/MembersDetails';
import DrawerStyles from '@src/Pages/Incidents/DrawerMode/DrawerMode.module.scss';
import styles from '../Team.module.scss';
const hardcodedData = {
data: {
id: 51,
name: 'DUMMY TEAM TESTING',
slackUserIds: ['U05KP1F523D', 'U05KRJ6RBHS'],
participants: [
{
id: 'U05KP1F523D',
name: 'Vijay Joshi',
email: 'vijay.joshi@navi.com',
image:
'https://avatars.slack-edge.com/2023-08-19/5770140728404_884eb71dcaf7d9e17f1e_32.jpg',
},
{
id: 'U05KRJ6RBHS',
name: 'ayush ranjan',
email: 'ayush.ranjan@navi.com',
image:
'https://secure.gravatar.com/avatar/373e7d55bcd66426441fa62eb82e1054.jpg?s=32\u0026d=https%3A%2F%2Fa.slack-edge.com%2Fdf10d%2Fimg%2Favatars%2Fava_0007-32.png',
},
],
lastUpdatedAt: '2023-09-12T12:12:34.19768Z',
webhookSlackChannelName: 'not found',
webhookSlackChannelId: '',
managerId: 'U05KP1F523D',
},
error: {},
status: 200,
};
const TeamForm = (props: TeamFormProps) => {
const { teamId, isExpanded, setTeamId, setLastUpdatedAt } = props;
const [data, setData] = useState<any>({});
@@ -183,7 +153,7 @@ const TeamForm = (props: TeamFormProps) => {
Members:
</Typography>
<MembersDetails data={data} />
<MembersDetails data={data} fetchTeamById={fetchTeamById} />
</div>
</div>

View File

@@ -19,7 +19,8 @@ import {
} from '@src/Pages/Team/constants';
const MembersDetails = (props: any) => {
const { data } = props;
//const { data } = props;
const { data, fetchTeamById } = props;
const totalMembers = data?.participants?.length;
const [showTotalMembers, setShowTotalMembers] = useState(10);
const [showRemoveButton, setShowRemoveButton] = useState(false);
@@ -31,6 +32,7 @@ const MembersDetails = (props: any) => {
.then(response => {
// Handle successful removal here, if needed
toast.success(`${slackUserId} has been removed from team ${teamId}.`);
fetchTeamById(true);
})
.catch(error => {
// Handle error if the removal request fails
@@ -47,6 +49,8 @@ const MembersDetails = (props: any) => {
.then(response => {
// Handle successful manager assignment here, if needed
toast.success(`${slackUserId} is now a manager in team ${teamId}.`);
//const url=FETCH_SINGLE_TEAM_DATA(teamId);
fetchTeamById(true);
})
.catch(error => {
// Handle error if the manager assignment request fails