Use teamIdForAPI for saving new queries

This commit is contained in:
Jacob Shandling 2023-07-19 14:17:59 -07:00
parent 27a1bfd805
commit b63f465ef7
2 changed files with 10 additions and 2 deletions

View file

@ -47,13 +47,21 @@ const QueryPage = ({
location,
}: IQueryPageProps): JSX.Element => {
const queryId = paramsQueryId ? parseInt(paramsQueryId, 10) : null;
const { currentTeamSummary: teamForQuery } = useTeamIdParam({
const {
currentTeamName: teamName,
teamIdForApi: apiTeamIdForQuery,
} = useTeamIdParam({
location,
router,
includeAllTeams: true,
includeNoTeam: false,
});
const teamForQuery =
apiTeamIdForQuery && teamName
? { id: apiTeamIdForQuery, name: teamName }
: undefined;
const handlePageError = useErrorHandler();
const {
isGlobalAdmin,

View file

@ -98,7 +98,7 @@ const QueryEditor = ({
} catch (createError: any) {
if (createError.data.errors[0].reason.includes("already exists")) {
const teamErrorText =
teamForQuery && teamForQuery?.id !== -1
teamForQuery && teamForQuery?.id !== 0
? `the ${teamForQuery.name} team`
: "all teams";
setBackendValidators({