l-min-components 1.0.1033 → 1.0.1040

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "l-min-components",
3
- "version": "1.0.1033",
3
+ "version": "1.0.1040",
4
4
  "type": "module",
5
5
  "files": [
6
6
  "src/assets",
@@ -68,10 +68,6 @@ const AppMainLayout = () => {
68
68
  handleGetUserPlan,
69
69
  getCurrentSubscriptionData,
70
70
  handleCurrentSubscription,
71
- handleGetDefaultAffiliate,
72
- handleGetAllAffiliate,
73
- getAllAffiliateData,
74
- getDefaultAffiliateData,
75
71
  } = useHeader();
76
72
 
77
73
  useEffect(() => {
@@ -303,8 +299,6 @@ const AppMainLayout = () => {
303
299
  !window.location.pathname.includes("manage-teams") && (
304
300
  <InstructorAccountSwitcher
305
301
  setAccountType={setAffiliatesActive}
306
- data={getAllAffiliateData?.data?.results}
307
- loading={getAllAffiliateData?.loading}
308
302
  generalData={generalData}
309
303
  onChange={(v) => setAffiliateAccount(v)}
310
304
  />
@@ -10,12 +10,7 @@ import OutsideAlerter from "../outsideEventChecker";
10
10
  import FullPageLoader from "../fullPageLoader";
11
11
  import deleteCookies from "./deleteCookies";
12
12
 
13
- const InstructorAccountSwitcher = ({
14
- setAccountType,
15
- data,
16
- generalData,
17
- onChange,
18
- }) => {
13
+ const InstructorAccountSwitcher = ({ generalData, onChange }) => {
19
14
  const [expiryFlow, setExpiryFlow] = useState();
20
15
  const [switchValue, setSwitchValue] = useState(null);
21
16
  const [selectedValue, setSelectedValue] = useState(null);
@@ -30,15 +25,13 @@ const InstructorAccountSwitcher = ({
30
25
  } = useHeader();
31
26
 
32
27
  useEffect(() => {
33
- if (getAllAffiliateData?.data?.count) {
34
- const account = generalData?.selectedAccount;
35
- if (account?.type?.toLocaleLowerCase() === "instructor") {
36
- handleGetAllAffiliate({ search });
37
- }
28
+ const account = generalData?.selectedAccount;
29
+ if (account?.type?.toLocaleLowerCase() === "instructor") {
30
+ handleGetAllAffiliate({ search });
38
31
  }
39
- }, [generalData?.selectedAccount, search, getAllAffiliateData?.data]);
32
+ }, [generalData?.selectedAccount, search]);
40
33
 
41
- const dropdownList = data?.map((item) => {
34
+ const dropdownList = getAllAffiliateData?.data?.results?.map((item) => {
42
35
  const image = item?.profile_photo?.url;
43
36
  return { name: item?.display_name, image, id: item?.id };
44
37
  });
@@ -102,18 +95,20 @@ const InstructorAccountSwitcher = ({
102
95
  }, []);
103
96
 
104
97
  useEffect(() => {
105
- handleGetDefaultAffiliate().then((res) => {
106
- if (res?.data) {
107
- const value = res?.data;
108
- const image = value?.profile_photo?.url;
109
- setSelectedValue(() => ({
110
- name: value?.display_name,
111
- image,
112
- id: value?.id,
113
- }));
114
- }
115
- });
116
- }, []);
98
+ if (getAllAffiliateData?.data?.results?.length > 0) {
99
+ handleGetDefaultAffiliate().then((res) => {
100
+ if (res?.data) {
101
+ const value = res?.data;
102
+ const image = value?.profile_photo?.url;
103
+ setSelectedValue(() => ({
104
+ name: value?.display_name,
105
+ image,
106
+ id: value?.id,
107
+ }));
108
+ }
109
+ });
110
+ }
111
+ }, [getAllAffiliateData?.data]);
117
112
 
118
113
  const handleSelection = async (item) => {
119
114
  const res = await handleSetDefaultAffiliate({
@@ -125,7 +120,7 @@ const InstructorAccountSwitcher = ({
125
120
  }
126
121
  };
127
122
 
128
- return getAllAffiliateData?.data?.count && !search ? (
123
+ return getAllAffiliateData?.data?.results?.length > 0 && !search ? (
129
124
  <>
130
125
  {(setDefaultAffiliateData?.loading ||
131
126
  getDefaultAffiliateData?.loading ||