mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-11-09 15:32:25 +00:00
fix: Fix routing issue with deeplink (#1721)
This commit is contained in:
parent
f56e1e546a
commit
962584fbfe
@ -60,22 +60,6 @@ const TeamsPage = () => {
|
|||||||
const [isAddingTeam, setIsAddingTeam] = useState<boolean>(false);
|
const [isAddingTeam, setIsAddingTeam] = useState<boolean>(false);
|
||||||
const [isAddingUsers, setIsAddingUsers] = useState<boolean>(false);
|
const [isAddingUsers, setIsAddingUsers] = useState<boolean>(false);
|
||||||
const [userList, setUserList] = useState<Array<User>>([]);
|
const [userList, setUserList] = useState<Array<User>>([]);
|
||||||
const fetchCurrentTeam = (name: string, update = false) => {
|
|
||||||
if (currentTeam?.name !== name || update) {
|
|
||||||
setIsLoading(true);
|
|
||||||
getTeamByName(name, ['users', 'owns'])
|
|
||||||
.then((res: AxiosResponse) => {
|
|
||||||
setCurrentTeam(res.data);
|
|
||||||
setIsLoading(false);
|
|
||||||
})
|
|
||||||
.catch((err: AxiosError) => {
|
|
||||||
if (err?.response?.data.code) {
|
|
||||||
setError(ERROR404);
|
|
||||||
}
|
|
||||||
setIsLoading(false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
const fetchTeams = () => {
|
const fetchTeams = () => {
|
||||||
setIsLoading(true);
|
setIsLoading(true);
|
||||||
@ -85,27 +69,46 @@ const TeamsPage = () => {
|
|||||||
setCurrentTeam(res.data.data[0]);
|
setCurrentTeam(res.data.data[0]);
|
||||||
}
|
}
|
||||||
setTeams(res.data.data);
|
setTeams(res.data.data);
|
||||||
setIsLoading(false);
|
|
||||||
})
|
})
|
||||||
.catch((err: AxiosError) => {
|
.catch((err: AxiosError) => {
|
||||||
if (err?.response?.data.code) {
|
if (err?.response?.data.code) {
|
||||||
setError(ERROR404);
|
setError(ERROR404);
|
||||||
}
|
}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
setIsLoading(false);
|
setIsLoading(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const fetchCurrentTeam = (name: string, update = false) => {
|
||||||
|
if (currentTeam?.name !== name || update) {
|
||||||
|
setIsLoading(true);
|
||||||
|
getTeamByName(name, ['users', 'owns'])
|
||||||
|
.then((res: AxiosResponse) => {
|
||||||
|
setCurrentTeam(res.data);
|
||||||
|
if (teams.length <= 0) {
|
||||||
|
fetchTeams();
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.catch((err: AxiosError) => {
|
||||||
|
if (err?.response?.data.code) {
|
||||||
|
setError(ERROR404);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
.finally(() => {
|
||||||
|
setIsLoading(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
const createNewTeam = (data: Team) => {
|
const createNewTeam = (data: Team) => {
|
||||||
createTeam(data)
|
createTeam(data)
|
||||||
.then((res: AxiosResponse) => {
|
.then((res: AxiosResponse) => {
|
||||||
if (res.data) {
|
if (res.data) {
|
||||||
fetchTeams();
|
fetchTeams();
|
||||||
setIsAddingTeam(false);
|
|
||||||
} else {
|
|
||||||
setIsAddingTeam(false);
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.catch(() => {
|
.finally(() => {
|
||||||
setIsAddingTeam(false);
|
setIsAddingTeam(false);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user