@replyke/core 6.0.0-beta.1 → 6.0.0-beta.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.
- package/dist/cjs/helpers/addNotificationsMessages.d.ts +2 -2
- package/dist/cjs/helpers/addNotificationsMessages.js +3 -2
- package/dist/cjs/helpers/addNotificationsMessages.js.map +1 -1
- package/dist/cjs/hooks/comments/useCommentSectionData.js +4 -1
- package/dist/cjs/hooks/comments/useCommentSectionData.js.map +1 -1
- package/dist/cjs/hooks/comments/useReplies.d.ts +0 -8
- package/dist/cjs/hooks/comments/useReplies.js +7 -1
- package/dist/cjs/hooks/comments/useReplies.js.map +1 -1
- package/dist/cjs/hooks/relationships/connections/index.d.ts +13 -0
- package/dist/cjs/hooks/relationships/connections/index.js +33 -0
- package/dist/cjs/hooks/relationships/connections/index.js.map +1 -0
- package/dist/cjs/hooks/relationships/connections/useAcceptConnection.d.ts +5 -0
- package/dist/cjs/hooks/relationships/connections/useAcceptConnection.js +76 -0
- package/dist/cjs/hooks/relationships/connections/useAcceptConnection.js.map +1 -0
- package/dist/cjs/hooks/relationships/connections/useConnectionManager.d.ts +26 -0
- package/dist/cjs/hooks/relationships/connections/useConnectionManager.js +342 -0
- package/dist/cjs/hooks/relationships/connections/useConnectionManager.js.map +1 -0
- package/dist/cjs/hooks/relationships/connections/useDeclineConnection.d.ts +5 -0
- package/dist/cjs/hooks/relationships/connections/useDeclineConnection.js +76 -0
- package/dist/cjs/hooks/relationships/connections/useDeclineConnection.js.map +1 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnectionStatus.d.ts +5 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnectionStatus.js +79 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnectionStatus.js.map +1 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnections.d.ts +7 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnections.js +95 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnections.js.map +1 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnectionsByUserId.d.ts +8 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnectionsByUserId.js +75 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnectionsByUserId.js.map +1 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnectionsCount.d.ts +3 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnectionsCount.js +72 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnectionsCount.js.map +1 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnectionsCountByUserId.d.ts +6 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnectionsCountByUserId.js +70 -0
- package/dist/cjs/hooks/relationships/connections/useFetchConnectionsCountByUserId.js.map +1 -0
- package/dist/cjs/hooks/relationships/connections/useFetchReceivedPendingConnections.d.ts +7 -0
- package/dist/cjs/hooks/relationships/connections/useFetchReceivedPendingConnections.js +95 -0
- package/dist/cjs/hooks/relationships/connections/useFetchReceivedPendingConnections.js.map +1 -0
- package/dist/cjs/hooks/relationships/connections/useFetchSentPendingConnections.d.ts +7 -0
- package/dist/cjs/hooks/relationships/connections/useFetchSentPendingConnections.js +95 -0
- package/dist/cjs/hooks/relationships/connections/useFetchSentPendingConnections.js.map +1 -0
- package/dist/cjs/hooks/relationships/connections/useRemoveConnection.d.ts +5 -0
- package/dist/cjs/hooks/relationships/connections/useRemoveConnection.js +76 -0
- package/dist/cjs/hooks/relationships/connections/useRemoveConnection.js.map +1 -0
- package/dist/cjs/hooks/relationships/connections/useRemoveConnectionByUserId.d.ts +5 -0
- package/dist/cjs/hooks/relationships/connections/useRemoveConnectionByUserId.js +79 -0
- package/dist/cjs/hooks/relationships/connections/useRemoveConnectionByUserId.js.map +1 -0
- package/dist/cjs/hooks/relationships/connections/useRequestConnection.d.ts +3 -0
- package/dist/cjs/hooks/relationships/connections/useRequestConnection.js +71 -0
- package/dist/cjs/hooks/relationships/connections/useRequestConnection.js.map +1 -0
- package/dist/cjs/hooks/relationships/follows/index.d.ts +12 -3
- package/dist/cjs/hooks/relationships/follows/index.js +25 -7
- package/dist/cjs/hooks/relationships/follows/index.js.map +1 -1
- package/dist/cjs/hooks/relationships/follows/useFetchFollowStatus.d.ts +8 -0
- package/dist/cjs/hooks/relationships/follows/{useFetchFollow.js → useFetchFollowStatus.js} +5 -5
- package/dist/cjs/hooks/relationships/follows/useFetchFollowStatus.js.map +1 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowers.d.ts +23 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowers.js +91 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowers.js.map +1 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowersByUserId.d.ts +24 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowersByUserId.js +70 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowersByUserId.js.map +1 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowersCount.d.ts +4 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowersCount.js +72 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowersCount.js.map +1 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowersCountByUserId.d.ts +6 -0
- package/dist/cjs/hooks/{users/useFetchUserFollowersCount.js → relationships/follows/useFetchFollowersCountByUserId.js} +9 -10
- package/dist/cjs/hooks/relationships/follows/useFetchFollowersCountByUserId.js.map +1 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowing.d.ts +23 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowing.js +94 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowing.js.map +1 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowingByUserId.d.ts +24 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowingByUserId.js +75 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowingByUserId.js.map +1 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowingCount.d.ts +4 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowingCount.js +72 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowingCount.js.map +1 -0
- package/dist/cjs/hooks/relationships/follows/useFetchFollowingCountByUserId.d.ts +6 -0
- package/dist/cjs/hooks/{users/useFetchUserFollowingCount.js → relationships/follows/useFetchFollowingCountByUserId.js} +9 -10
- package/dist/cjs/hooks/relationships/follows/useFetchFollowingCountByUserId.js.map +1 -0
- package/dist/cjs/hooks/relationships/follows/useFollowManager.js +8 -8
- package/dist/cjs/hooks/relationships/follows/useFollowManager.js.map +1 -1
- package/dist/cjs/hooks/relationships/follows/useUnfollowByFollowId.d.ts +4 -0
- package/dist/cjs/hooks/relationships/follows/useUnfollowByFollowId.js +78 -0
- package/dist/cjs/hooks/relationships/follows/useUnfollowByFollowId.js.map +1 -0
- package/dist/cjs/hooks/relationships/follows/useUnfollowUserByUserId.d.ts +4 -0
- package/dist/cjs/hooks/relationships/follows/{useUnfollowUser.js → useUnfollowUserByUserId.js} +5 -5
- package/dist/cjs/hooks/relationships/follows/useUnfollowUserByUserId.js.map +1 -0
- package/dist/cjs/hooks/useStableObject.d.ts +11 -0
- package/dist/cjs/hooks/useStableObject.js +26 -0
- package/dist/cjs/hooks/useStableObject.js.map +1 -0
- package/dist/cjs/hooks/users/index.d.ts +0 -2
- package/dist/cjs/hooks/users/index.js +1 -5
- package/dist/cjs/hooks/users/index.js.map +1 -1
- package/dist/cjs/hooks/users/useUpdateUser.d.ts +1 -2
- package/dist/cjs/hooks/users/useUpdateUser.js +7 -2
- package/dist/cjs/hooks/users/useUpdateUser.js.map +1 -1
- package/dist/cjs/index.d.ts +4 -2
- package/dist/cjs/index.js +28 -6
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/interfaces/models/AppNotification.d.ts +32 -4
- package/dist/cjs/interfaces/models/Connection.d.ts +88 -0
- package/dist/cjs/interfaces/models/Connection.js +3 -0
- package/dist/cjs/interfaces/models/Connection.js.map +1 -0
- package/dist/cjs/interfaces/models/Follow.d.ts +2 -0
- package/dist/cjs/store/slices/entityListsSlice.js +9 -0
- package/dist/cjs/store/slices/entityListsSlice.js.map +1 -1
- package/dist/cjs/utils/objectComparison.d.ts +8 -0
- package/dist/cjs/utils/objectComparison.js +63 -0
- package/dist/cjs/utils/objectComparison.js.map +1 -0
- package/dist/esm/helpers/addNotificationsMessages.d.ts +2 -2
- package/dist/esm/helpers/addNotificationsMessages.js +3 -2
- package/dist/esm/helpers/addNotificationsMessages.js.map +1 -1
- package/dist/esm/hooks/comments/useCommentSectionData.js +4 -1
- package/dist/esm/hooks/comments/useCommentSectionData.js.map +1 -1
- package/dist/esm/hooks/comments/useReplies.d.ts +0 -8
- package/dist/esm/hooks/comments/useReplies.js +7 -1
- package/dist/esm/hooks/comments/useReplies.js.map +1 -1
- package/dist/esm/hooks/relationships/connections/index.d.ts +13 -0
- package/dist/esm/hooks/relationships/connections/index.js +14 -0
- package/dist/esm/hooks/relationships/connections/index.js.map +1 -0
- package/dist/esm/hooks/relationships/connections/useAcceptConnection.d.ts +5 -0
- package/dist/esm/hooks/relationships/connections/useAcceptConnection.js +71 -0
- package/dist/esm/hooks/relationships/connections/useAcceptConnection.js.map +1 -0
- package/dist/esm/hooks/relationships/connections/useConnectionManager.d.ts +26 -0
- package/dist/esm/hooks/relationships/connections/useConnectionManager.js +337 -0
- package/dist/esm/hooks/relationships/connections/useConnectionManager.js.map +1 -0
- package/dist/esm/hooks/relationships/connections/useDeclineConnection.d.ts +5 -0
- package/dist/esm/hooks/relationships/connections/useDeclineConnection.js +71 -0
- package/dist/esm/hooks/relationships/connections/useDeclineConnection.js.map +1 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnectionStatus.d.ts +5 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnectionStatus.js +74 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnectionStatus.js.map +1 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnections.d.ts +7 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnections.js +90 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnections.js.map +1 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnectionsByUserId.d.ts +8 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnectionsByUserId.js +70 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnectionsByUserId.js.map +1 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnectionsCount.d.ts +3 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnectionsCount.js +67 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnectionsCount.js.map +1 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnectionsCountByUserId.d.ts +6 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnectionsCountByUserId.js +65 -0
- package/dist/esm/hooks/relationships/connections/useFetchConnectionsCountByUserId.js.map +1 -0
- package/dist/esm/hooks/relationships/connections/useFetchReceivedPendingConnections.d.ts +7 -0
- package/dist/esm/hooks/relationships/connections/useFetchReceivedPendingConnections.js +90 -0
- package/dist/esm/hooks/relationships/connections/useFetchReceivedPendingConnections.js.map +1 -0
- package/dist/esm/hooks/relationships/connections/useFetchSentPendingConnections.d.ts +7 -0
- package/dist/esm/hooks/relationships/connections/useFetchSentPendingConnections.js +90 -0
- package/dist/esm/hooks/relationships/connections/useFetchSentPendingConnections.js.map +1 -0
- package/dist/esm/hooks/relationships/connections/useRemoveConnection.d.ts +5 -0
- package/dist/esm/hooks/relationships/connections/useRemoveConnection.js +71 -0
- package/dist/esm/hooks/relationships/connections/useRemoveConnection.js.map +1 -0
- package/dist/esm/hooks/relationships/connections/useRemoveConnectionByUserId.d.ts +5 -0
- package/dist/esm/hooks/relationships/connections/useRemoveConnectionByUserId.js +74 -0
- package/dist/esm/hooks/relationships/connections/useRemoveConnectionByUserId.js.map +1 -0
- package/dist/esm/hooks/relationships/connections/useRequestConnection.d.ts +3 -0
- package/dist/esm/hooks/relationships/connections/useRequestConnection.js +66 -0
- package/dist/esm/hooks/relationships/connections/useRequestConnection.js.map +1 -0
- package/dist/esm/hooks/relationships/follows/index.d.ts +12 -3
- package/dist/esm/hooks/relationships/follows/index.js +12 -3
- package/dist/esm/hooks/relationships/follows/index.js.map +1 -1
- package/dist/esm/hooks/relationships/follows/useFetchFollowStatus.d.ts +8 -0
- package/dist/esm/hooks/relationships/follows/{useFetchFollow.js → useFetchFollowStatus.js} +5 -5
- package/dist/esm/hooks/relationships/follows/useFetchFollowStatus.js.map +1 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowers.d.ts +23 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowers.js +86 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowers.js.map +1 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowersByUserId.d.ts +24 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowersByUserId.js +65 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowersByUserId.js.map +1 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowersCount.d.ts +4 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowersCount.js +67 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowersCount.js.map +1 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowersCountByUserId.d.ts +6 -0
- package/dist/esm/hooks/{users/useFetchUserFollowersCount.js → relationships/follows/useFetchFollowersCountByUserId.js} +8 -9
- package/dist/esm/hooks/relationships/follows/useFetchFollowersCountByUserId.js.map +1 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowing.d.ts +23 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowing.js +89 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowing.js.map +1 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowingByUserId.d.ts +24 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowingByUserId.js +70 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowingByUserId.js.map +1 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowingCount.d.ts +4 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowingCount.js +67 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowingCount.js.map +1 -0
- package/dist/esm/hooks/relationships/follows/useFetchFollowingCountByUserId.d.ts +6 -0
- package/dist/esm/hooks/{users/useFetchUserFollowingCount.js → relationships/follows/useFetchFollowingCountByUserId.js} +8 -9
- package/dist/esm/hooks/relationships/follows/useFetchFollowingCountByUserId.js.map +1 -0
- package/dist/esm/hooks/relationships/follows/useFollowManager.js +8 -8
- package/dist/esm/hooks/relationships/follows/useFollowManager.js.map +1 -1
- package/dist/esm/hooks/relationships/follows/useUnfollowByFollowId.d.ts +4 -0
- package/dist/esm/hooks/relationships/follows/useUnfollowByFollowId.js +73 -0
- package/dist/esm/hooks/relationships/follows/useUnfollowByFollowId.js.map +1 -0
- package/dist/esm/hooks/relationships/follows/useUnfollowUserByUserId.d.ts +4 -0
- package/dist/esm/hooks/relationships/follows/{useUnfollowUser.js → useUnfollowUserByUserId.js} +5 -5
- package/dist/esm/hooks/relationships/follows/useUnfollowUserByUserId.js.map +1 -0
- package/dist/esm/hooks/useStableObject.d.ts +11 -0
- package/dist/esm/hooks/useStableObject.js +23 -0
- package/dist/esm/hooks/useStableObject.js.map +1 -0
- package/dist/esm/hooks/users/index.d.ts +0 -2
- package/dist/esm/hooks/users/index.js +0 -2
- package/dist/esm/hooks/users/index.js.map +1 -1
- package/dist/esm/hooks/users/useUpdateUser.d.ts +1 -2
- package/dist/esm/hooks/users/useUpdateUser.js +7 -2
- package/dist/esm/hooks/users/useUpdateUser.js.map +1 -1
- package/dist/esm/index.d.ts +4 -2
- package/dist/esm/index.js +4 -2
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/interfaces/models/AppNotification.d.ts +32 -4
- package/dist/esm/interfaces/models/Connection.d.ts +88 -0
- package/dist/esm/interfaces/models/Connection.js +2 -0
- package/dist/esm/interfaces/models/Connection.js.map +1 -0
- package/dist/esm/interfaces/models/Follow.d.ts +2 -0
- package/dist/esm/store/slices/entityListsSlice.js +9 -0
- package/dist/esm/store/slices/entityListsSlice.js.map +1 -1
- package/dist/esm/utils/objectComparison.d.ts +8 -0
- package/dist/esm/utils/objectComparison.js +59 -0
- package/dist/esm/utils/objectComparison.js.map +1 -0
- package/package.json +1 -1
- package/dist/cjs/hooks/relationships/follows/useFetchFollow.d.ts +0 -6
- package/dist/cjs/hooks/relationships/follows/useFetchFollow.js.map +0 -1
- package/dist/cjs/hooks/relationships/follows/useUnfollowUser.d.ts +0 -4
- package/dist/cjs/hooks/relationships/follows/useUnfollowUser.js.map +0 -1
- package/dist/cjs/hooks/users/useFetchUserFollowersCount.d.ts +0 -6
- package/dist/cjs/hooks/users/useFetchUserFollowersCount.js.map +0 -1
- package/dist/cjs/hooks/users/useFetchUserFollowingCount.d.ts +0 -6
- package/dist/cjs/hooks/users/useFetchUserFollowingCount.js.map +0 -1
- package/dist/esm/hooks/relationships/follows/useFetchFollow.d.ts +0 -6
- package/dist/esm/hooks/relationships/follows/useFetchFollow.js.map +0 -1
- package/dist/esm/hooks/relationships/follows/useUnfollowUser.d.ts +0 -4
- package/dist/esm/hooks/relationships/follows/useUnfollowUser.js.map +0 -1
- package/dist/esm/hooks/users/useFetchUserFollowersCount.d.ts +0 -6
- package/dist/esm/hooks/users/useFetchUserFollowersCount.js.map +0 -1
- package/dist/esm/hooks/users/useFetchUserFollowingCount.d.ts +0 -6
- package/dist/esm/hooks/users/useFetchUserFollowingCount.js.map +0 -1
|
@@ -35,13 +35,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
import { useCallback } from "react";
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
function
|
|
38
|
+
import useProject from "../../projects/useProject";
|
|
39
|
+
import axios from "../../../config/axios";
|
|
40
|
+
function useFetchFollowersCountByUserId() {
|
|
41
41
|
var _this = this;
|
|
42
|
-
var axios = useAxiosPrivate();
|
|
43
42
|
var projectId = useProject().projectId;
|
|
44
|
-
var
|
|
43
|
+
var fetchFollowersCountByUserId = useCallback(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
45
44
|
var response;
|
|
46
45
|
var userId = _b.userId;
|
|
47
46
|
return __generator(this, function (_c) {
|
|
@@ -59,8 +58,8 @@ function useFetchUserFollowersCount() {
|
|
|
59
58
|
return [2 /*return*/, response.data];
|
|
60
59
|
}
|
|
61
60
|
});
|
|
62
|
-
}); }, [
|
|
63
|
-
return
|
|
61
|
+
}); }, [projectId]);
|
|
62
|
+
return fetchFollowersCountByUserId;
|
|
64
63
|
}
|
|
65
|
-
export default
|
|
66
|
-
//# sourceMappingURL=
|
|
64
|
+
export default useFetchFollowersCountByUserId;
|
|
65
|
+
//# sourceMappingURL=useFetchFollowersCountByUserId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchFollowersCountByUserId.js","sourceRoot":"","sources":["../../../../../src/hooks/relationships/follows/useFetchFollowersCountByUserId.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAE1C,SAAS,8BAA8B;IAAvC,iBAuBC;IAtBS,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IAEnC,IAAM,2BAA2B,GAAG,WAAW,CAC7C,gEAAO,EAA8B;;YAA5B,MAAM,YAAA;;;;oBACb,IAAI,CAAC,MAAM,EAAE,CAAC;wBACZ,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;oBACzC,CAAC;oBAED,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAEgB,qBAAM,KAAK,CAAC,GAAG,CAC9B,WAAI,SAAS,oBAAU,MAAM,qBAAkB,CAChD,EAAA;;oBAFK,QAAQ,GAAG,SAEhB;oBAED,sBAAO,QAAQ,CAAC,IAAyB,EAAC;;;SAC3C,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,OAAO,2BAA2B,CAAC;AACrC,CAAC;AAED,eAAe,8BAA8B,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { User } from "../../../interfaces/models/User";
|
|
2
|
+
export interface FollowingWithFollowInfo {
|
|
3
|
+
followId: string;
|
|
4
|
+
user: User;
|
|
5
|
+
followedAt: string;
|
|
6
|
+
}
|
|
7
|
+
export interface FollowingResponse {
|
|
8
|
+
following: FollowingWithFollowInfo[];
|
|
9
|
+
pagination: {
|
|
10
|
+
currentPage: number;
|
|
11
|
+
totalPages: number;
|
|
12
|
+
totalCount: number;
|
|
13
|
+
hasNextPage: boolean;
|
|
14
|
+
hasPreviousPage: boolean;
|
|
15
|
+
limit: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface FetchFollowingParams {
|
|
19
|
+
page?: number;
|
|
20
|
+
limit?: number;
|
|
21
|
+
}
|
|
22
|
+
declare function useFetchFollowing(): ({ page, limit }?: FetchFollowingParams) => Promise<FollowingResponse>;
|
|
23
|
+
export default useFetchFollowing;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
38
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
39
|
+
if (ar || !(i in from)) {
|
|
40
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
41
|
+
ar[i] = from[i];
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
45
|
+
};
|
|
46
|
+
import { useCallback } from "react";
|
|
47
|
+
import useAxiosPrivate from "../../../config/useAxiosPrivate";
|
|
48
|
+
import useProject from "../../projects/useProject";
|
|
49
|
+
import { useUser } from "../../user";
|
|
50
|
+
function useFetchFollowing() {
|
|
51
|
+
var _this = this;
|
|
52
|
+
var axios = useAxiosPrivate();
|
|
53
|
+
var projectId = useProject().projectId;
|
|
54
|
+
var user = useUser().user;
|
|
55
|
+
var fetchFollowing = useCallback(function () {
|
|
56
|
+
var args_1 = [];
|
|
57
|
+
for (var _i = 0; _i < arguments.length; _i++) {
|
|
58
|
+
args_1[_i] = arguments[_i];
|
|
59
|
+
}
|
|
60
|
+
return __awaiter(_this, __spreadArray([], args_1, true), void 0, function (_a) {
|
|
61
|
+
var response;
|
|
62
|
+
var _b = _a === void 0 ? {} : _a, _c = _b.page, page = _c === void 0 ? 1 : _c, _d = _b.limit, limit = _d === void 0 ? 20 : _d;
|
|
63
|
+
return __generator(this, function (_e) {
|
|
64
|
+
switch (_e.label) {
|
|
65
|
+
case 0:
|
|
66
|
+
if (!projectId) {
|
|
67
|
+
throw new Error("No projectId available.");
|
|
68
|
+
}
|
|
69
|
+
if (!user) {
|
|
70
|
+
throw new Error("No user is logged in.");
|
|
71
|
+
}
|
|
72
|
+
return [4 /*yield*/, axios.get("/".concat(projectId, "/follows/following"), {
|
|
73
|
+
params: {
|
|
74
|
+
page: page,
|
|
75
|
+
limit: limit,
|
|
76
|
+
},
|
|
77
|
+
withCredentials: true,
|
|
78
|
+
})];
|
|
79
|
+
case 1:
|
|
80
|
+
response = _e.sent();
|
|
81
|
+
return [2 /*return*/, response.data];
|
|
82
|
+
}
|
|
83
|
+
});
|
|
84
|
+
});
|
|
85
|
+
}, [axios, projectId, user]);
|
|
86
|
+
return fetchFollowing;
|
|
87
|
+
}
|
|
88
|
+
export default useFetchFollowing;
|
|
89
|
+
//# sourceMappingURL=useFetchFollowing.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchFollowing.js","sourceRoot":"","sources":["../../../../../src/hooks/relationships/follows/useFetchFollowing.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AA0BrC,SAAS,iBAAiB;IAA1B,iBA6BC;IA5BC,IAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IACxB,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IAC3B,IAAA,IAAI,GAAK,OAAO,EAAE,KAAd,CAAe;IAE3B,IAAM,cAAc,GAAG,WAAW,CAChC;;;;;mFAAO,EAAmD;;gBAAnD,qBAAiD,EAAE,KAAA,EAAjD,YAAQ,EAAR,IAAI,mBAAG,CAAC,KAAA,EAAE,aAAU,EAAV,KAAK,mBAAG,EAAE,KAAA;;;;wBAC3B,IAAI,CAAC,SAAS,EAAE,CAAC;4BACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;wBAC7C,CAAC;wBAED,IAAI,CAAC,IAAI,EAAE,CAAC;4BACV,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;wBAC3C,CAAC;wBAEgB,qBAAM,KAAK,CAAC,GAAG,CAAC,WAAI,SAAS,uBAAoB,EAAE;gCAClE,MAAM,EAAE;oCACN,IAAI,MAAA;oCACJ,KAAK,OAAA;iCACN;gCACD,eAAe,EAAE,IAAI;6BACtB,CAAC,EAAA;;wBANI,QAAQ,GAAG,SAMf;wBAEF,sBAAO,QAAQ,CAAC,IAAyB,EAAC;;;;KAC3C,EACD,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,CACzB,CAAC;IAEF,OAAO,cAAc,CAAC;AACxB,CAAC;AAED,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { User } from "../../../interfaces/models/User";
|
|
2
|
+
export interface FollowingWithFollowInfo {
|
|
3
|
+
followId: string;
|
|
4
|
+
user: User;
|
|
5
|
+
followedAt: string;
|
|
6
|
+
}
|
|
7
|
+
export interface FollowingResponse {
|
|
8
|
+
following: FollowingWithFollowInfo[];
|
|
9
|
+
pagination: {
|
|
10
|
+
currentPage: number;
|
|
11
|
+
totalPages: number;
|
|
12
|
+
totalCount: number;
|
|
13
|
+
hasNextPage: boolean;
|
|
14
|
+
hasPreviousPage: boolean;
|
|
15
|
+
limit: number;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
export interface FetchFollowingByUserIdParams {
|
|
19
|
+
userId: string;
|
|
20
|
+
page?: number;
|
|
21
|
+
limit?: number;
|
|
22
|
+
}
|
|
23
|
+
declare function useFetchFollowingByUserId(): ({ userId, page, limit }: FetchFollowingByUserIdParams) => Promise<FollowingResponse>;
|
|
24
|
+
export default useFetchFollowingByUserId;
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { useCallback } from "react";
|
|
38
|
+
import useProject from "../../projects/useProject";
|
|
39
|
+
import axios from "../../../config/axios";
|
|
40
|
+
function useFetchFollowingByUserId() {
|
|
41
|
+
var _this = this;
|
|
42
|
+
var projectId = useProject().projectId;
|
|
43
|
+
var fetchFollowingByUserId = useCallback(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
44
|
+
var response;
|
|
45
|
+
var userId = _b.userId, _c = _b.page, page = _c === void 0 ? 1 : _c, _d = _b.limit, limit = _d === void 0 ? 20 : _d;
|
|
46
|
+
return __generator(this, function (_e) {
|
|
47
|
+
switch (_e.label) {
|
|
48
|
+
case 0:
|
|
49
|
+
if (!userId) {
|
|
50
|
+
throw new Error("No userId provided.");
|
|
51
|
+
}
|
|
52
|
+
if (!projectId) {
|
|
53
|
+
throw new Error("No projectId available.");
|
|
54
|
+
}
|
|
55
|
+
return [4 /*yield*/, axios.get("/".concat(projectId, "/users/").concat(userId, "/following"), {
|
|
56
|
+
params: {
|
|
57
|
+
page: page,
|
|
58
|
+
limit: limit,
|
|
59
|
+
},
|
|
60
|
+
})];
|
|
61
|
+
case 1:
|
|
62
|
+
response = _e.sent();
|
|
63
|
+
return [2 /*return*/, response.data];
|
|
64
|
+
}
|
|
65
|
+
});
|
|
66
|
+
}); }, [projectId]);
|
|
67
|
+
return fetchFollowingByUserId;
|
|
68
|
+
}
|
|
69
|
+
export default useFetchFollowingByUserId;
|
|
70
|
+
//# sourceMappingURL=useFetchFollowingByUserId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchFollowingByUserId.js","sourceRoot":"","sources":["../../../../../src/hooks/relationships/follows/useFetchFollowingByUserId.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,UAAU,MAAM,2BAA2B,CAAC;AAEnD,OAAO,KAAK,MAAM,uBAAuB,CAAC;AA0B1C,SAAS,yBAAyB;IAAlC,iBA6BC;IA5BS,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IAEnC,IAAM,sBAAsB,GAAG,WAAW,CACxC,gEAAO,EAA8D;;YAA5D,MAAM,YAAA,EAAE,YAAQ,EAAR,IAAI,mBAAG,CAAC,KAAA,EAAE,aAAU,EAAV,KAAK,mBAAG,EAAE,KAAA;;;;oBACnC,IAAI,CAAC,MAAM,EAAE,CAAC;wBACZ,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;oBACzC,CAAC;oBAED,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAEgB,qBAAM,KAAK,CAAC,GAAG,CAC9B,WAAI,SAAS,oBAAU,MAAM,eAAY,EACzC;4BACE,MAAM,EAAE;gCACN,IAAI,MAAA;gCACJ,KAAK,OAAA;6BACN;yBACF,CACF,EAAA;;oBARK,QAAQ,GAAG,SAQhB;oBAED,sBAAO,QAAQ,CAAC,IAAyB,EAAC;;;SAC3C,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,OAAO,sBAAsB,CAAC;AAChC,CAAC;AAED,eAAe,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { useCallback } from "react";
|
|
38
|
+
import useAxiosPrivate from "../../../config/useAxiosPrivate";
|
|
39
|
+
import useProject from "../../projects/useProject";
|
|
40
|
+
import { useUser } from "../../user";
|
|
41
|
+
function useFetchFollowingCount() {
|
|
42
|
+
var _this = this;
|
|
43
|
+
var axios = useAxiosPrivate();
|
|
44
|
+
var projectId = useProject().projectId;
|
|
45
|
+
var user = useUser().user;
|
|
46
|
+
var fetchFollowingCount = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
47
|
+
var response;
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
if (!projectId) {
|
|
52
|
+
throw new Error("No projectId available.");
|
|
53
|
+
}
|
|
54
|
+
if (!user) {
|
|
55
|
+
throw new Error("No user is logged in.");
|
|
56
|
+
}
|
|
57
|
+
return [4 /*yield*/, axios.get("/".concat(projectId, "/follows/following-count"), { withCredentials: true })];
|
|
58
|
+
case 1:
|
|
59
|
+
response = _a.sent();
|
|
60
|
+
return [2 /*return*/, response.data];
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}); }, [axios, projectId, user]);
|
|
64
|
+
return fetchFollowingCount;
|
|
65
|
+
}
|
|
66
|
+
export default useFetchFollowingCount;
|
|
67
|
+
//# sourceMappingURL=useFetchFollowingCount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchFollowingCount.js","sourceRoot":"","sources":["../../../../../src/hooks/relationships/follows/useFetchFollowingCount.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,SAAS,sBAAsB;IAA/B,iBA0BC;IAzBC,IAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IACxB,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IAC3B,IAAA,IAAI,GAAK,OAAO,EAAE,KAAd,CAAe;IAE3B,IAAM,mBAAmB,GAAG,WAAW,CACrC;;;;;oBACE,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAED,IAAI,CAAC,IAAI,EAAE,CAAC;wBACV,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;oBAC3C,CAAC;oBAEgB,qBAAM,KAAK,CAAC,GAAG,CAC9B,WAAI,SAAS,6BAA0B,EACvC,EAAE,eAAe,EAAE,IAAI,EAAE,CAC1B,EAAA;;oBAHK,QAAQ,GAAG,SAGhB;oBAED,sBAAO,QAAQ,CAAC,IAAyB,EAAC;;;SAC3C,EACD,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,CACzB,CAAC;IAEF,OAAO,mBAAmB,CAAC;AAC7B,CAAC;AAED,eAAe,sBAAsB,CAAC"}
|
|
@@ -35,13 +35,12 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
35
35
|
}
|
|
36
36
|
};
|
|
37
37
|
import { useCallback } from "react";
|
|
38
|
-
import
|
|
39
|
-
import
|
|
40
|
-
function
|
|
38
|
+
import useProject from "../../projects/useProject";
|
|
39
|
+
import axios from "../../../config/axios";
|
|
40
|
+
function useFetchFollowingCountByUserId() {
|
|
41
41
|
var _this = this;
|
|
42
|
-
var axios = useAxiosPrivate();
|
|
43
42
|
var projectId = useProject().projectId;
|
|
44
|
-
var
|
|
43
|
+
var fetchFollowingCountByUserId = useCallback(function (_a) { return __awaiter(_this, [_a], void 0, function (_b) {
|
|
45
44
|
var response;
|
|
46
45
|
var userId = _b.userId;
|
|
47
46
|
return __generator(this, function (_c) {
|
|
@@ -59,8 +58,8 @@ function useFetchUserFollowingCount() {
|
|
|
59
58
|
return [2 /*return*/, response.data];
|
|
60
59
|
}
|
|
61
60
|
});
|
|
62
|
-
}); }, [
|
|
63
|
-
return
|
|
61
|
+
}); }, [projectId]);
|
|
62
|
+
return fetchFollowingCountByUserId;
|
|
64
63
|
}
|
|
65
|
-
export default
|
|
66
|
-
//# sourceMappingURL=
|
|
64
|
+
export default useFetchFollowingCountByUserId;
|
|
65
|
+
//# sourceMappingURL=useFetchFollowingCountByUserId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useFetchFollowingCountByUserId.js","sourceRoot":"","sources":["../../../../../src/hooks/relationships/follows/useFetchFollowingCountByUserId.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,KAAK,MAAM,uBAAuB,CAAC;AAE1C,SAAS,8BAA8B;IAAvC,iBAuBC;IAtBS,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IAEnC,IAAM,2BAA2B,GAAG,WAAW,CAC7C,gEAAO,EAA8B;;YAA5B,MAAM,YAAA;;;;oBACb,IAAI,CAAC,MAAM,EAAE,CAAC;wBACZ,MAAM,IAAI,KAAK,CAAC,qBAAqB,CAAC,CAAC;oBACzC,CAAC;oBAED,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAEgB,qBAAM,KAAK,CAAC,GAAG,CAC9B,WAAI,SAAS,oBAAU,MAAM,qBAAkB,CAChD,EAAA;;oBAFK,QAAQ,GAAG,SAEhB;oBAED,sBAAO,QAAQ,CAAC,IAAyB,EAAC;;;SAC3C,EACD,CAAC,SAAS,CAAC,CACZ,CAAC;IAEF,OAAO,2BAA2B,CAAC;AACrC,CAAC;AAED,eAAe,8BAA8B,CAAC"}
|
|
@@ -36,8 +36,8 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
};
|
|
37
37
|
import { useState, useEffect, useCallback } from "react";
|
|
38
38
|
import useFollowUser from "./useFollowUser";
|
|
39
|
-
import
|
|
40
|
-
import
|
|
39
|
+
import useUnfollowUserByUserId from "./useUnfollowUserByUserId";
|
|
40
|
+
import useFetchFollowStatus from "./useFetchFollowStatus";
|
|
41
41
|
import useUser from "../../user/useUser";
|
|
42
42
|
function useFollowManager(_a) {
|
|
43
43
|
var _this = this;
|
|
@@ -46,8 +46,8 @@ function useFollowManager(_a) {
|
|
|
46
46
|
var _b = useState(null), isFollowing = _b[0], setIsFollowing = _b[1];
|
|
47
47
|
var _c = useState(true), isLoading = _c[0], setIsLoading = _c[1];
|
|
48
48
|
var followUser = useFollowUser();
|
|
49
|
-
var
|
|
50
|
-
var
|
|
49
|
+
var unfollowUserByUserId = useUnfollowUserByUserId();
|
|
50
|
+
var fetchFollowStatus = useFetchFollowStatus();
|
|
51
51
|
useEffect(function () {
|
|
52
52
|
var loadFollowStatus = function () { return __awaiter(_this, void 0, void 0, function () {
|
|
53
53
|
var result, error_1;
|
|
@@ -56,7 +56,7 @@ function useFollowManager(_a) {
|
|
|
56
56
|
case 0:
|
|
57
57
|
_a.trys.push([0, 2, 3, 4]);
|
|
58
58
|
setIsLoading(true);
|
|
59
|
-
return [4 /*yield*/,
|
|
59
|
+
return [4 /*yield*/, fetchFollowStatus({ userId: userId })];
|
|
60
60
|
case 1:
|
|
61
61
|
result = _a.sent();
|
|
62
62
|
setIsFollowing(result.isFollowing);
|
|
@@ -76,7 +76,7 @@ function useFollowManager(_a) {
|
|
|
76
76
|
if (userId && (user === null || user === void 0 ? void 0 : user.id) !== userId) {
|
|
77
77
|
loadFollowStatus();
|
|
78
78
|
}
|
|
79
|
-
}, [userId,
|
|
79
|
+
}, [userId, fetchFollowStatus]);
|
|
80
80
|
var toggleFollow = useCallback(function () { return __awaiter(_this, void 0, void 0, function () {
|
|
81
81
|
var error_2;
|
|
82
82
|
return __generator(this, function (_a) {
|
|
@@ -88,7 +88,7 @@ function useFollowManager(_a) {
|
|
|
88
88
|
case 1:
|
|
89
89
|
_a.trys.push([1, 6, , 7]);
|
|
90
90
|
if (!isFollowing) return [3 /*break*/, 3];
|
|
91
|
-
return [4 /*yield*/,
|
|
91
|
+
return [4 /*yield*/, unfollowUserByUserId({ userId: userId })];
|
|
92
92
|
case 2:
|
|
93
93
|
_a.sent();
|
|
94
94
|
setIsFollowing(false);
|
|
@@ -106,7 +106,7 @@ function useFollowManager(_a) {
|
|
|
106
106
|
case 7: return [2 /*return*/];
|
|
107
107
|
}
|
|
108
108
|
});
|
|
109
|
-
}); }, [isFollowing, isLoading, userId, followUser,
|
|
109
|
+
}); }, [isFollowing, isLoading, userId, followUser, unfollowUserByUserId]);
|
|
110
110
|
return {
|
|
111
111
|
isFollowing: isFollowing,
|
|
112
112
|
isLoading: isLoading,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFollowManager.js","sourceRoot":"","sources":["../../../../../src/hooks/relationships/follows/useFollowManager.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,
|
|
1
|
+
{"version":3,"file":"useFollowManager.js","sourceRoot":"","sources":["../../../../../src/hooks/relationships/follows/useFollowManager.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACzD,OAAO,aAAa,MAAM,iBAAiB,CAAC;AAC5C,OAAO,uBAAuB,MAAM,2BAA2B,CAAC;AAChE,OAAO,oBAAoB,MAAM,wBAAwB,CAAC;AAC1D,OAAO,OAAO,MAAM,oBAAoB,CAAC;AAMzC,SAAS,gBAAgB,CAAC,EAAgC;IAA1D,iBAkDC;QAlD2B,MAAM,YAAA;IACxB,IAAA,IAAI,GAAK,OAAO,EAAE,KAAd,CAAe;IAErB,IAAA,KAAgC,QAAQ,CAAiB,IAAI,CAAC,EAA7D,WAAW,QAAA,EAAE,cAAc,QAAkC,CAAC;IAC/D,IAAA,KAA4B,QAAQ,CAAC,IAAI,CAAC,EAAzC,SAAS,QAAA,EAAE,YAAY,QAAkB,CAAC;IAEjD,IAAM,UAAU,GAAG,aAAa,EAAE,CAAC;IACnC,IAAM,oBAAoB,GAAG,uBAAuB,EAAE,CAAC;IACvD,IAAM,iBAAiB,GAAG,oBAAoB,EAAE,CAAC;IAEjD,SAAS,CAAC;QACR,IAAM,gBAAgB,GAAG;;;;;;wBAErB,YAAY,CAAC,IAAI,CAAC,CAAC;wBACJ,qBAAM,iBAAiB,CAAC,EAAE,MAAM,QAAA,EAAE,CAAC,EAAA;;wBAA5C,MAAM,GAAG,SAAmC;wBAClD,cAAc,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;;;;wBAEnC,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,OAAK,CAAC,CAAC;wBACvD,cAAc,CAAC,KAAK,CAAC,CAAC;;;wBAEtB,YAAY,CAAC,KAAK,CAAC,CAAC;;;;;aAEvB,CAAC;QAEF,IAAI,MAAM,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,MAAK,MAAM,EAAE,CAAC;YAClC,gBAAgB,EAAE,CAAC;QACrB,CAAC;IACH,CAAC,EAAE,CAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,CAAC;IAEhC,IAAM,YAAY,GAAG,WAAW,CAAC;;;;;oBAC/B,IAAI,WAAW,KAAK,IAAI,IAAI,SAAS,IAAI,CAAA,IAAI,aAAJ,IAAI,uBAAJ,IAAI,CAAE,EAAE,MAAK,MAAM;wBAAE,sBAAO;;;;yBAG/D,WAAW,EAAX,wBAAW;oBACb,qBAAM,oBAAoB,CAAC,EAAE,MAAM,QAAA,EAAE,CAAC,EAAA;;oBAAtC,SAAsC,CAAC;oBACvC,cAAc,CAAC,KAAK,CAAC,CAAC;;wBAEtB,qBAAM,UAAU,CAAC,EAAE,MAAM,QAAA,EAAE,CAAC,EAAA;;oBAA5B,SAA4B,CAAC;oBAC7B,cAAc,CAAC,IAAI,CAAC,CAAC;;;;;oBAGvB,OAAO,CAAC,KAAK,CAAC,iCAAiC,EAAE,OAAK,CAAC,CAAC;;;;;SAE3D,EAAE,CAAC,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,UAAU,EAAE,oBAAoB,CAAC,CAAC,CAAC;IAEvE,OAAO;QACL,WAAW,aAAA;QACX,SAAS,WAAA;QACT,YAAY,cAAA;KACb,CAAC;AACJ,CAAC;AAED,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
2
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
3
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
4
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
5
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
6
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
7
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
8
|
+
});
|
|
9
|
+
};
|
|
10
|
+
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
11
|
+
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
|
|
12
|
+
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
13
|
+
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
14
|
+
function step(op) {
|
|
15
|
+
if (f) throw new TypeError("Generator is already executing.");
|
|
16
|
+
while (g && (g = 0, op[0] && (_ = 0)), _) try {
|
|
17
|
+
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
18
|
+
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
19
|
+
switch (op[0]) {
|
|
20
|
+
case 0: case 1: t = op; break;
|
|
21
|
+
case 4: _.label++; return { value: op[1], done: false };
|
|
22
|
+
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
23
|
+
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
24
|
+
default:
|
|
25
|
+
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
26
|
+
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
27
|
+
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
28
|
+
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
29
|
+
if (t[2]) _.ops.pop();
|
|
30
|
+
_.trys.pop(); continue;
|
|
31
|
+
}
|
|
32
|
+
op = body.call(thisArg, _);
|
|
33
|
+
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
34
|
+
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
import { useCallback } from "react";
|
|
38
|
+
import useAxiosPrivate from "../../../config/useAxiosPrivate";
|
|
39
|
+
import useProject from "../../projects/useProject";
|
|
40
|
+
import { useUser } from "../../user";
|
|
41
|
+
function useUnfollowByFollowId() {
|
|
42
|
+
var _this = this;
|
|
43
|
+
var axios = useAxiosPrivate();
|
|
44
|
+
var projectId = useProject().projectId;
|
|
45
|
+
var user = useUser().user;
|
|
46
|
+
var unfollowByFollowId = useCallback(function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
47
|
+
var followId;
|
|
48
|
+
return __generator(this, function (_a) {
|
|
49
|
+
switch (_a.label) {
|
|
50
|
+
case 0:
|
|
51
|
+
followId = props.followId;
|
|
52
|
+
if (!projectId) {
|
|
53
|
+
throw new Error("No project specified");
|
|
54
|
+
}
|
|
55
|
+
if (!user) {
|
|
56
|
+
throw new Error("No user is logged in");
|
|
57
|
+
}
|
|
58
|
+
if (!followId) {
|
|
59
|
+
throw new Error("No follow ID was provided");
|
|
60
|
+
}
|
|
61
|
+
return [4 /*yield*/, axios.delete("/".concat(projectId, "/follows/").concat(followId), {
|
|
62
|
+
withCredentials: true,
|
|
63
|
+
})];
|
|
64
|
+
case 1:
|
|
65
|
+
_a.sent();
|
|
66
|
+
return [2 /*return*/];
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
}); }, [axios, projectId, user]);
|
|
70
|
+
return unfollowByFollowId;
|
|
71
|
+
}
|
|
72
|
+
export default useUnfollowByFollowId;
|
|
73
|
+
//# sourceMappingURL=useUnfollowByFollowId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUnfollowByFollowId.js","sourceRoot":"","sources":["../../../../../src/hooks/relationships/follows/useUnfollowByFollowId.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,SAAS,qBAAqB;IAA9B,iBA4BC;IA3BC,IAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IACxB,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IAC3B,IAAA,IAAI,GAAK,OAAO,EAAE,KAAd,CAAe;IAE3B,IAAM,kBAAkB,GAAG,WAAW,CACpC,UAAO,KAA2B;;;;;oBACxB,QAAQ,GAAK,KAAK,SAAV,CAAW;oBAC3B,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,CAAC;oBAED,IAAI,CAAC,IAAI,EAAE,CAAC;wBACV,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,CAAC;oBAED,IAAI,CAAC,QAAQ,EAAE,CAAC;wBACd,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;oBAC/C,CAAC;oBAED,qBAAM,KAAK,CAAC,MAAM,CAAC,WAAI,SAAS,sBAAY,QAAQ,CAAE,EAAE;4BACtD,eAAe,EAAE,IAAI;yBACtB,CAAC,EAAA;;oBAFF,SAEE,CAAC;;;;SACJ,EACD,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,CACzB,CAAC;IAEF,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAED,eAAe,qBAAqB,CAAC"}
|
package/dist/esm/hooks/relationships/follows/{useUnfollowUser.js → useUnfollowUserByUserId.js}
RENAMED
|
@@ -38,12 +38,12 @@ import { useCallback } from "react";
|
|
|
38
38
|
import useAxiosPrivate from "../../../config/useAxiosPrivate";
|
|
39
39
|
import useProject from "../../projects/useProject";
|
|
40
40
|
import { useUser } from "../../user";
|
|
41
|
-
function
|
|
41
|
+
function useUnfollowUserByUserId() {
|
|
42
42
|
var _this = this;
|
|
43
43
|
var axios = useAxiosPrivate();
|
|
44
44
|
var projectId = useProject().projectId;
|
|
45
45
|
var user = useUser().user;
|
|
46
|
-
var
|
|
46
|
+
var unfollowUserByUserId = useCallback(function (props) { return __awaiter(_this, void 0, void 0, function () {
|
|
47
47
|
var userId;
|
|
48
48
|
return __generator(this, function (_a) {
|
|
49
49
|
switch (_a.label) {
|
|
@@ -70,7 +70,7 @@ function useUnfollowUser() {
|
|
|
70
70
|
}
|
|
71
71
|
});
|
|
72
72
|
}); }, [axios, projectId, user]);
|
|
73
|
-
return
|
|
73
|
+
return unfollowUserByUserId;
|
|
74
74
|
}
|
|
75
|
-
export default
|
|
76
|
-
//# sourceMappingURL=
|
|
75
|
+
export default useUnfollowUserByUserId;
|
|
76
|
+
//# sourceMappingURL=useUnfollowUserByUserId.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useUnfollowUserByUserId.js","sourceRoot":"","sources":["../../../../../src/hooks/relationships/follows/useUnfollowUserByUserId.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AACpC,OAAO,eAAe,MAAM,iCAAiC,CAAC;AAC9D,OAAO,UAAU,MAAM,2BAA2B,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAErC,SAAS,uBAAuB;IAAhC,iBAgCC;IA/BC,IAAM,KAAK,GAAG,eAAe,EAAE,CAAC;IACxB,IAAA,SAAS,GAAK,UAAU,EAAE,UAAjB,CAAkB;IAC3B,IAAA,IAAI,GAAK,OAAO,EAAE,KAAd,CAAe;IAE3B,IAAM,oBAAoB,GAAG,WAAW,CACtC,UAAO,KAAyB;;;;;oBACtB,MAAM,GAAK,KAAK,OAAV,CAAW;oBACzB,IAAI,CAAC,SAAS,EAAE,CAAC;wBACf,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,CAAC;oBAED,IAAI,CAAC,IAAI,EAAE,CAAC;wBACV,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;oBAC1C,CAAC;oBAED,IAAI,CAAC,MAAM,EAAE,CAAC;wBACZ,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;oBAC7C,CAAC;oBAED,IAAI,MAAM,KAAK,IAAI,CAAC,EAAE,EAAE,CAAC;wBACvB,MAAM,IAAI,KAAK,CAAC,iCAAiC,CAAC,CAAC;oBACrD,CAAC;oBAED,qBAAM,KAAK,CAAC,MAAM,CAAC,WAAI,SAAS,oBAAU,MAAM,YAAS,EAAE;4BACzD,eAAe,EAAE,IAAI;yBACtB,CAAC,EAAA;;oBAFF,SAEE,CAAC;;;;SACJ,EACD,CAAC,KAAK,EAAE,SAAS,EAAE,IAAI,CAAC,CACzB,CAAC;IAEF,OAAO,oBAAoB,CAAC;AAC9B,CAAC;AAED,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hook that returns a stable reference to an object that only changes
|
|
3
|
+
* when the content of the object actually changes (deep comparison).
|
|
4
|
+
*
|
|
5
|
+
* This is useful for preventing unnecessary re-renders when objects are
|
|
6
|
+
* recreated with the same content on every render.
|
|
7
|
+
*
|
|
8
|
+
* @param obj - The object to stabilize
|
|
9
|
+
* @returns A stable reference to the object
|
|
10
|
+
*/
|
|
11
|
+
export declare function useStableObject<T extends Record<string, any> | undefined>(obj: T): T;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useRef } from "react";
|
|
2
|
+
import { deepEqual } from "../utils/objectComparison";
|
|
3
|
+
/**
|
|
4
|
+
* Hook that returns a stable reference to an object that only changes
|
|
5
|
+
* when the content of the object actually changes (deep comparison).
|
|
6
|
+
*
|
|
7
|
+
* This is useful for preventing unnecessary re-renders when objects are
|
|
8
|
+
* recreated with the same content on every render.
|
|
9
|
+
*
|
|
10
|
+
* @param obj - The object to stabilize
|
|
11
|
+
* @returns A stable reference to the object
|
|
12
|
+
*/
|
|
13
|
+
export function useStableObject(obj) {
|
|
14
|
+
var ref = useRef(obj);
|
|
15
|
+
// If the new object is deeply equal to the previous one, return the previous reference
|
|
16
|
+
if (deepEqual(ref.current, obj)) {
|
|
17
|
+
return ref.current;
|
|
18
|
+
}
|
|
19
|
+
// Otherwise, update the ref and return the new object
|
|
20
|
+
ref.current = obj;
|
|
21
|
+
return obj;
|
|
22
|
+
}
|
|
23
|
+
//# sourceMappingURL=useStableObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useStableObject.js","sourceRoot":"","sources":["../../../src/hooks/useStableObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AAEtD;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAC7B,GAAM;IAEN,IAAM,GAAG,GAAG,MAAM,CAAI,GAAG,CAAC,CAAC;IAE3B,uFAAuF;IACvF,IAAI,SAAS,CAAC,GAAG,CAAC,OAAO,EAAE,GAAG,CAAC,EAAE,CAAC;QAChC,OAAO,GAAG,CAAC,OAAO,CAAC;IACrB,CAAC;IAED,sDAAsD;IACtD,GAAG,CAAC,OAAO,GAAG,GAAG,CAAC;IAClB,OAAO,GAAG,CAAC;AACb,CAAC"}
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export { default as useFetchUser } from "./useFetchUser";
|
|
2
2
|
export { default as useFetchUserByForeignId } from "./useFetchUserByForeignId";
|
|
3
|
-
export { default as useFetchUserFollowersCount } from "./useFetchUserFollowersCount";
|
|
4
|
-
export { default as useFetchUserFollowingCount } from "./useFetchUserFollowingCount";
|
|
5
3
|
export { default as useCheckUsernameAvailability } from "./useCheckUsernameAvailability";
|
|
6
4
|
export { default as useFetchUserSuggestions } from "./useFetchUserSuggestions";
|
|
7
5
|
export { default as useMentions } from "./useMentions";
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
export { default as useFetchUser } from "./useFetchUser";
|
|
2
2
|
export { default as useFetchUserByForeignId } from "./useFetchUserByForeignId";
|
|
3
|
-
export { default as useFetchUserFollowersCount } from "./useFetchUserFollowersCount";
|
|
4
|
-
export { default as useFetchUserFollowingCount } from "./useFetchUserFollowingCount";
|
|
5
3
|
export { default as useCheckUsernameAvailability } from "./useCheckUsernameAvailability";
|
|
6
4
|
export { default as useFetchUserSuggestions } from "./useFetchUserSuggestions";
|
|
7
5
|
export { default as useMentions } from "./useMentions";
|