@ludo.ninja/components 2.2.10 → 2.2.11
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.
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const useGetOpportunities: () => {
|
|
1
|
+
export declare const useGetOpportunities: (availableProfileId: string) => {
|
|
2
2
|
opportunities: import("@ludo.ninja/api/build/graphql_tools/__generated__/opportunitiesHost/schema").Maybe<Pick<import("@ludo.ninja/api/build/graphql_tools/__generated__/opportunitiesHost/schema").IOpportunityV2, "views" | "createdAt" | "blockchain" | "name" | "description" | "collection" | "liked" | "opportunityId" | "brandId" | "categoryId" | "opportunityStatus" | "opportunityType" | "notificationType" | "brandName" | "brandDescription" | "brandMedia" | "brandUrl" | "brandIndustry" | "categoryName" | "ludoUrl" | "projectUrl" | "activeFrom" | "activeUntil" | "minXpLevel" | "maxXpLevel" | "minRank" | "maxRank" | "media" | "reportLink" | "clicks" | "minWalletValue" | "maxWalletValue" | "shareLink">>[];
|
|
3
3
|
isLoadingOpportunities: boolean;
|
|
4
4
|
};
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.useGetOpportunities = void 0;
|
|
4
|
+
const store_1 = require("../../../modules/user/store");
|
|
5
|
+
const ui_1 = require("../../../store/ui");
|
|
4
6
|
const api_1 = require("@ludo.ninja/api");
|
|
5
7
|
const schema_1 = require("@ludo.ninja/api/build/graphql_tools/__generated__/opportunitiesHost/schema");
|
|
6
8
|
const type_1 = require("@ludo.ninja/ui/build/system/Alert/type");
|
|
7
|
-
const ui_1 = require("../../../store/ui");
|
|
8
|
-
const store_1 = require("../../../modules/user/store");
|
|
9
9
|
const react_1 = require("react");
|
|
10
|
-
const useGetOpportunities = () => {
|
|
10
|
+
const useGetOpportunities = (availableProfileId) => {
|
|
11
11
|
const isSignedIn = (0, store_1.useUserStore)((state) => state.isSignedIn);
|
|
12
|
+
const user = (0, store_1.useUserStore)((state) => state.user);
|
|
12
13
|
const openAlert = (0, ui_1.useUiStore)((state) => state.openAlert);
|
|
13
14
|
const [opportunities, setOpportunities] = (0, react_1.useState)([]);
|
|
14
15
|
const [getOpportunities, { loading }] = (0, schema_1.useFetchOpportunitiesForProfileLazyQuery)({
|
|
@@ -23,7 +24,7 @@ const useGetOpportunities = () => {
|
|
|
23
24
|
},
|
|
24
25
|
});
|
|
25
26
|
(0, react_1.useEffect)(() => {
|
|
26
|
-
if (isSignedIn && !opportunities.length) {
|
|
27
|
+
if (isSignedIn && !opportunities.length && availableProfileId === user?.userId) {
|
|
27
28
|
getOpportunities().then((res) => {
|
|
28
29
|
setOpportunities(res.data?.fetchOpportunitiesForProfile || []);
|
|
29
30
|
});
|