mirror of
https://github.com/fleetdm/fleet
synced 2026-05-23 17:08:53 +00:00
Use teamIdForAPI for saving new queries
This commit is contained in:
parent
27a1bfd805
commit
b63f465ef7
2 changed files with 10 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -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({
|
||||
|
|
|
|||
Loading…
Reference in a new issue