Skip to content

Commit cba0383

Browse files
committed
show uploader correctly
1 parent 8e706f1 commit cba0383

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

frontend/pages/ManageControlsPage/SetupExperience/cards/SetupAssistant/SetupAssistant.tsx

+14-6
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
11
import React, { useState } from "react";
22
import { useQuery } from "react-query";
3+
import { AxiosError } from "axios";
34

45
import { IConfig } from "interfaces/config";
5-
import { API_NO_TEAM_ID, ITeam, ITeamConfig } from "interfaces/team";
6+
import { API_NO_TEAM_ID, ITeamConfig } from "interfaces/team";
67
import configAPI from "services/entities/config";
78
import teamsAPI, { ILoadTeamResponse } from "services/entities/teams";
89
import mdmAPI, {
910
IAppleSetupEnrollmentProfileResponse,
1011
} from "services/entities/mdm";
12+
import { DEFAULT_USE_QUERY_OPTIONS } from "utilities/constants";
1113

1214
import SectionHeader from "components/SectionHeader";
1315
import Spinner from "components/Spinner";
@@ -18,8 +20,6 @@ import SetupAssistantProfileUploader from "./components/SetupAssistantProfileUpl
1820
import SetuAssistantProfileCard from "./components/SetupAssistantProfileCard/SetupAssistantProfileCard";
1921
import DeleteAutoEnrollmentProfile from "./components/DeleteAutoEnrollmentProfile";
2022
import AdvancedOptionsForm from "./components/AdvancedOptionsForm";
21-
import { DEFAULT_USE_QUERY_OPTIONS } from "utilities/constants";
22-
import { Axios, AxiosError } from "axios";
2323

2424
const baseClass = "setup-assistant";
2525

@@ -54,10 +54,14 @@ const StartupAssistant = ({ currentTeamId }: ISetupAssistantProps) => {
5454
data: enrollmentProfileData,
5555
isLoading: isLoadingEnrollmentProfile,
5656
isError: isErrorEnrollmentProfile,
57+
error: enrollmentProfileError,
5758
} = useQuery<IAppleSetupEnrollmentProfileResponse, AxiosError>(
5859
["enrollment_profile", currentTeamId],
5960
() => mdmAPI.getSetupEnrollmentProfile(currentTeamId),
60-
DEFAULT_USE_QUERY_OPTIONS
61+
{
62+
...DEFAULT_USE_QUERY_OPTIONS,
63+
retry: false,
64+
}
6165
);
6266

6367
const getReleaseDeviceSetting = () => {
@@ -75,10 +79,14 @@ const StartupAssistant = ({ currentTeamId }: ISetupAssistantProps) => {
7579

7680
const defaultReleaseDeviceSetting = getReleaseDeviceSetting();
7781

82+
const isLoading =
83+
isLoadingGlobalConfig || isLoadingTeamConfig || isLoadingEnrollmentProfile;
84+
const enrollmentProfileNotFound = enrollmentProfileError?.status === 404;
85+
7886
return (
7987
<div className={baseClass}>
8088
<SectionHeader title="Setup assistant" />
81-
{isLoadingEnrollmentProfile ? (
89+
{isLoading ? (
8290
<Spinner />
8391
) : (
8492
<div className={`${baseClass}__content`}>
@@ -92,7 +100,7 @@ const StartupAssistant = ({ currentTeamId }: ISetupAssistantProps) => {
92100
newTab
93101
/>
94102
</p>
95-
{!enrollmentProfileData ? (
103+
{enrollmentProfileNotFound ? (
96104
<SetupAssistantProfileUploader
97105
currentTeamId={currentTeamId}
98106
onUpload={() => 1}

0 commit comments

Comments
 (0)