React hooks
Enumerations
Interfaces
Variables
ThemeWrapper
• Const
ThemeWrapper: React.FC
<RootComponentProps
>
React component that fetches the user-selected theme name from localStorage and passes it to the ThemeSelector component along with all available themes.
Defined in
ui/hooks/src/utils/theme-wrapper.tsx:10
constants
• constants: Object
Type declaration
Name | Type |
---|---|
BASE_DECISION_URL | string |
BASE_MODERATOR_URL | string |
BASE_REASONS_URL | string |
BASE_REPORT_URL | string |
BASE_STATUS_URL | string |
CHECK_MODERATOR_KEY | string |
CONNECT_PROVIDER_KEY | string |
DEFAULT_FETCH_TIMEOUT | number |
DELISTED_ITEMS_KEY | string |
INJECTED_PROVIDER_KEY | string |
KEPT_ITEMS_KEY | string |
LOG_ITEMS_KEY | string |
MODERATED_CACHE_KEY_PREFIX | string |
MODERATION_COUNT_CACHE_KEY_PREFIX | string |
MODERATION_ITEMS_COUNT_KEY | string |
MODERATION_ITEM_FLAGS_KEY | string |
MODERATION_STATUS_KEY | string |
PENDING_CACHE_KEY_PREFIX | string |
PENDING_ITEMS_KEY | string |
REQUIRED_NETWORK_KEY | string |
TOKEN_VALIDATION_KEY | string |
Defined in
Functions
checkPostActive
▸ checkPostActive(entry
): boolean
Utility to check whether a post is active or not
Parameters
Name | Type |
---|---|
entry | Pick <PostResponse , "content" | "delisted" > |
Returns
boolean
Defined in
ui/hooks/src/utils/checkPostActive.ts:6
createPendingEntry
▸ createPendingEntry(author
, entryPublishData
): PendingEntry
Utility to create an entry yet to be published
Parameters
Name | Type |
---|---|
author | IProfileData |
entryPublishData | IPublishData & { entryId? : string } |
Returns
PendingEntry
Defined in
ui/hooks/src/utils/entry-utils.ts:268
getLinkPreview
▸ getLinkPreview(url
): Promise
<LinkPreview
>
Utility to get preview of a specified url
Parameters
Name | Type |
---|---|
url | string |
Returns
Promise
<LinkPreview
>
Defined in
ui/hooks/src/utils/media-utils.ts:108
getMediaUrl
▸ getMediaUrl(hash?
): Object
Utility to build gateway links to ipfs content
Parameters
Name | Type |
---|---|
hash? | string |
Returns
Object
Name | Type |
---|---|
fallbackLink | string |
originLink | string |
pathLink | string |
Defined in
ui/hooks/src/utils/media-utils.ts:17
logError
▸ logError(name
, errorInfo
): void
Utility to log error to a specified logger
Parameters
Name | Type |
---|---|
name | string |
errorInfo | Error |
Returns
void
Defined in
ui/hooks/src/utils/error-handler.ts:21
mapEntry
▸ mapEntry(entry
, logger?
): IEntryData
Remap entry data coming from a response to the format expected by EntryCard content - from b64 to slate format profile images - append ipfs gateway entry images - append ipfs gateway
Parameters
Name | Type |
---|---|
entry | PostResponse | CommentResponse |
logger? | ILogger |
Returns
IEntryData
Defined in
ui/hooks/src/utils/entry-utils.ts:99
switchToRequiredNetwork
▸ switchToRequiredNetwork(): Promise
<void
>
An utility function to switch to required network - Metamask
Returns
Promise
<void
>
Defined in
ui/hooks/src/use-injected-provider.ts:37
uploadMediaToTextile
▸ uploadMediaToTextile(data
, isUrl?
): Promise
<{ data
: { originalSrc
: string
; size
: { height
: number
; naturalHeight
: number
; naturalWidth
: number
; width
: number
} = res.size; src
: { fallbackUrl
: string
= ipfsLinks.fallbackLink; url
: string
= ipfsLinks.originLink } } ; error
: undefined
= error } | { data
: undefined
; error
: any
= error }>
Utility to upload media to textile bucket
Parameters
Name | Type | Default value |
---|---|---|
data | File | undefined |
isUrl | boolean | false |
Returns
Promise
<{ data
: { originalSrc
: string
; size
: { height
: number
; naturalHeight
: number
; naturalWidth
: number
; width
: number
} = res.size; src
: { fallbackUrl
: string
= ipfsLinks.fallbackLink; url
: string
= ipfsLinks.originLink } } ; error
: undefined
= error } | { data
: undefined
; error
: any
= error }>
Defined in
ui/hooks/src/utils/media-utils.ts:62
useAnalytics
▸ useAnalytics(): [UseAnalyticsActions
]
Hook to handle analytics
example
useAnalytics hook
const [analyticsActions] = useAnalytics();
analyticsActions.trackEvent({
category: 'some-category',
action: 'some-action',
});
Returns
[UseAnalyticsActions
]
Defined in
ui/hooks/src/use-analytics.tsx:44
useAppDescription
▸ useAppDescription(ipfsLink
): UseQueryResult
<string
, Error
>
Hook to get detailed description for app
example
useAppDescription hook
const detailedDescriptionQuery = useAppDescription('ipfslinktodescription');
const description = detailedDescriptionQuery.data
Parameters
Name | Type |
---|---|
ipfsLink | string |
Returns
UseQueryResult
<string
, Error
>
Defined in
ui/hooks/src/use-app-description.ts:23
useCheckModerator
▸ useCheckModerator(loggedUser
): UseQueryResult
<number
, Error
>
Hook to check if a user is a moderator
example
useCheckModerator hook
const checkModeratorQuery = useCheckModerator('logged-in-user-eth-address');
const isModerator = checkModeratorQuery.data === 200;
Parameters
Name | Type |
---|---|
loggedUser | string |
Returns
UseQueryResult
<number
, Error
>
Defined in
ui/hooks/src/use-moderation.ts:207
useCheckNewNotifications
▸ useCheckNewNotifications(loggedEthAddress
): UseQueryResult
<boolean
, Error
>
Hook to check for new notifications
example
useCheckNewNotifications hook
const checkNewNotificationsQuery = useCheckNewNotifications('logged-in-user-eth-address');
const hasNewNotifications = checkNewNotificationsQuery.data;
Parameters
Name | Type |
---|---|
loggedEthAddress | string |
Returns
UseQueryResult
<boolean
, Error
>
Defined in
ui/hooks/src/use-notifications.ts:127
useCheckSignup
▸ useCheckSignup(ethAddress
): UseQueryResult
<boolean
, Error
>
Hook to check if a user is already registered
example
useCheckSignup hook
const checkSignupQuery = useCheckSignup('0x42b35jk53ifq');
// checkSignupQuery.data returns a boolean value which determines if one should proceed with signup process or not
Parameters
Name | Type |
---|---|
ethAddress | string |
Returns
UseQueryResult
<boolean
, Error
>
Defined in
useComment
▸ useComment(commentID
, enabler?
): UseQueryResult
<CommentResponse
, Error
>
Hook for fetching data for a specific comment
example
useComment hook
const itemType = 'COMMENT';
const commentQuery = useComment('some-comment-id', true);
const itemData = React.useMemo(() => {
if (itemType === 'COMMENT' && commentQuery.isSuccess) {
// mapEntry is a utility function that transforms the comment/post data into required format.
return mapEntry(commentQuery.data);
}
}, [itemType, commentQuery.data, commentQuery.isSuccess]);
Parameters
Name | Type | Default value |
---|---|---|
commentID | string | undefined |
enabler | boolean | true |
Returns
UseQueryResult
<CommentResponse
, Error
>
Defined in
ui/hooks/src/use-comments.ts:116
useConnectProvider
▸ useConnectProvider(provider
): UseQueryResult
<boolean
, unknown
>
Hook to connect with one of the supported providers
example
useConnectProvider hook
const connectProviderQuery = useConnectProvider('selectedProvider');
// can be used as enabler for useNetworkState hook; so this check works only if provider has been connected.
const networkStateQuery = useNetworkState(connectProviderQuery.data);
Parameters
Name | Type |
---|---|
provider | EthProviders |
Returns
UseQueryResult
<boolean
, unknown
>
Defined in
ui/hooks/src/use-injected-provider.ts:78
useCreateComment
▸ useCreateComment(): UseMutationResult
<string
, unknown
, IPublishData
& { postID
: string
}, { entryId
: string
= pendingID; optimisticComment
: IPublishData
& { postID
: string
} }>
Hook for creating a new comment
example
useCreateComment hook
const createCommentQuery = useCreateComment('some-comment-id');
const newCommentData = { textContent: 'some text content', author: 'comment author', pubKey: 'comment-author-pubkey' }
createCommentQuery.mutate({ ...newCommentData , postID: 'some-post-id' });
Returns
UseMutationResult
<string
, unknown
, IPublishData
& { postID
: string
}, { entryId
: string
= pendingID; optimisticComment
: IPublishData
& { postID
: string
} }>
Defined in
ui/hooks/src/use-comments.ts:207
useCreatePost
▸ useCreatePost(): UseMutationResult
<string
, unknown
, IPublishData
, { entryId
: string
= pendingID; optimisticEntry
: IPublishData
& { isPublishing
: boolean
= true } }>
Hook to create a new post pass the publish data from the editor to the mutate function
example
useCreatePost hook
const publishPostQuery = useCreatePost();
publishPostQuery.mutate({ pubKey: 'author-public-key', ...});
Returns
UseMutationResult
<string
, unknown
, IPublishData
, { entryId
: string
= pendingID; optimisticEntry
: IPublishData
& { isPublishing
: boolean
= true } }>
Defined in
useCurrentNetwork
▸ useCurrentNetwork(enabler?
): UseQueryResult
<string
, unknown
>
Hook to check the user's current web3 network
example
useCurrentNetwork hook
const currentNetworkQuery = useCurrentNetwork(true);
const network = currentNetworkQuery.data;
Parameters
Name | Type |
---|---|
enabler? | boolean |
Returns
UseQueryResult
<string
, unknown
>
network name
Defined in
ui/hooks/src/use-network-state.ts:53
useDeleteBookmark
▸ useDeleteBookmark(): UseMutationResult
<{ data
: string
[] }, unknown
, string
, { prevBmks
: { entryId
: string
; type
: EntityTypes
}[] }>
Hook used to delete a bookmark
example
useDeleteBookmark hook
const deleteBookmarkQuery = useDeleteBookmark();
deleteBookmarkQuery.mutate('dbkjjouyahljfe');
Returns
UseMutationResult
<{ data
: string
[] }, unknown
, string
, { prevBmks
: { entryId
: string
; type
: EntityTypes
}[] }>
Defined in
ui/hooks/src/use-bookmarks.ts:111
useDeleteComment
▸ useDeleteComment(commentID
): UseMutationResult
<true
, unknown
, string
, { previousComment
: CommentResponse
}>
Hook for deleting a specific comment
example
useDeleteComment hook
const deleteCommentQuery = useDeleteComment('some-comment-id');
deleteCommentQuery.mutate('some-comment-id');
Parameters
Name | Type |
---|---|
commentID | string |
Returns
UseMutationResult
<true
, unknown
, string
, { previousComment
: CommentResponse
}>
Defined in
ui/hooks/src/use-comments.ts:147
useDeletePost
▸ useDeletePost(postID
): UseMutationResult
<{ data
: { removePost
: boolean
} }, unknown
, string
, { previousPost
: Post_Response
}>
Hook to delete a post
example
useDeletePost hook
const deletePostQuery = useDeletePost('some-post-id');
deletePostQuery.mutate('some-post-id');
Parameters
Name | Type |
---|---|
postID | string |
Returns
UseMutationResult
<{ data
: { removePost
: boolean
} }, unknown
, string
, { previousPost
: Post_Response
}>
Defined in
useEditComment
▸ useEditComment(commentID
, hasCommentData
): UseMutationResult
<void
| { data
: { editComment
: boolean
} }, unknown
, IPublishData
& { postID
: string
}, { comment
: IPublishData
& { postID
: string
} }>
Hook for editing a comment
example
useEditComment hook
const editCommentQuery = useEditComment('some-comment-id', true);
const editedCommentData = { textContent: 'some text content', author: 'comment author', pubKey: 'comment-author-pubkey' }
editCommentQuery.mutate({ ...editedCommentData, postID: 'some-post-id' });
Parameters
Name | Type |
---|---|
commentID | string |
hasCommentData | boolean |
Returns
UseMutationResult
<void
| { data
: { editComment
: boolean
} }, unknown
, IPublishData
& { postID
: string
}, { comment
: IPublishData
& { postID
: string
} }>
Defined in
ui/hooks/src/use-comments.ts:259
useEditPost
▸ useEditPost(): UseMutationResult
<boolean
, Error
, IPublishData
& { entryID
: string
}, { editedPost
: IPublishData
& { entryID
: string
} }>
Hook to edit a post pass the edited post data to the mutate function
example
useEditPost hook
const editPostQuery = useEditPost();
editPostQuery.mutate({ entryID: 'some-entry-id', ...});
Returns
UseMutationResult
<boolean
, Error
, IPublishData
& { entryID
: string
}, { editedPost
: IPublishData
& { entryID
: string
} }>
Defined in
useEnsByAddress
▸ useEnsByAddress(ethAddress
): UseQueryResult
<string
, Error
>
Hook to resolve an ethereum address to an ENS name
example
useEnsByAddress hook
const ensByAddressQuery = useEnsByAddress('logged-in-user-eth-address');
// do something with the returned status of the query
const querySuccess = ensByAddressQuery.isSuccess
Parameters
Name | Type |
---|---|
ethAddress | string |
Returns
UseQueryResult
<string
, Error
>
Defined in
ui/hooks/src/use-username.ts:241
useEnsRegistration
▸ useEnsRegistration(pubKey?
): UseMutationResult
<{ makeDefaultProvider
: string
}, Error
, { userName
: string
}, { currentProfile
: IProfileData
}>
Hook to register a new ENS name. Pass as payload, the username to the mutate function
example
useEnsRegistration hook
const registerEnsQuery = useEnsRegistration('logged-in-user-pubkey');
// do something with the returned status of the query
React.useEffect(()=> {
if (registerEnsQuery.status === 'success') {
// perform an action
}
}, [registerEnsQuery])
Parameters
Name | Type |
---|---|
pubKey? | string |
Returns
UseMutationResult
<{ makeDefaultProvider
: string
}, Error
, { userName
: string
}, { currentProfile
: IProfileData
}>
Defined in
ui/hooks/src/use-username.ts:162
useEntryNavigation
▸ useEntryNavigation(navigateFn?
, currentPostId?
): (navigationDetails
: IContentClickDetails
, itemType
: EntityTypes
) => void
Hook to navigation to entry's page
example
useEntryNavigation hook
// navigateFn handles the actual navigation
const handleEntryNavigate = useEntryNavigation(navigateTo, 'current-post-id');
Parameters
Name | Type |
---|---|
navigateFn? | (args : NavigateToParams ) => void |
currentPostId? | string |
Returns
fn
▸ (navigationDetails
, itemType
): void
Parameters
Name | Type |
---|---|
navigationDetails | IContentClickDetails |
itemType | EntityTypes |
Returns
void
Defined in
ui/hooks/src/use-navigation.ts:17
useFetchNotifications
▸ useFetchNotifications(loggedEthAddress
): UseQueryResult
<any
[], Error
>
Hook to get a user's notifications
example
useFetchNotifications hook
const fetchNotificationsQuery = useFetchNotifications('logged-in-user-eth-address');
const notifications = fetchNotificationsQuery.data;
Parameters
Name | Type |
---|---|
loggedEthAddress | string |
Returns
UseQueryResult
<any
[], Error
>
Defined in
ui/hooks/src/use-notifications.ts:57
useGetAllInstalledApps
▸ useGetAllInstalledApps(enabler?
): UseQueryResult
<any
, Error
>
Hook to get all the user's installed apps
example
useGetAllInstalledApps hook
const installedAppsQuery = useGetAllInstalledApps(true);
const installedApps = installedAppsQuery.data
Parameters
Name | Type |
---|---|
enabler? | boolean |
Returns
UseQueryResult
<any
, Error
>
Defined in
ui/hooks/src/use-app-settings.ts:47
useGetAllIntegrationReleaseIds
▸ useGetAllIntegrationReleaseIds(integrationName
, offset?
): UseQueryResult
<{ nextIndex
: any
= data.next; releaseIds
: any
}, Error
>
Hook to get all the release ids for an integration
example
useGetAllIntegrationReleaseIds hook
const releaseIdsQuery = useGetAllIntegrationReleaseIds('awesome integration');
const releaseIds = releaseIdsQuery.data?.releaseIds
Parameters
Name | Type |
---|---|
integrationName | string |
offset? | number |
Returns
UseQueryResult
<{ nextIndex
: any
= data.next; releaseIds
: any
}, Error
>
Defined in
ui/hooks/src/use-integration-registry.ts:178
useGetAllIntegrationsIds
▸ useGetAllIntegrationsIds(enabler?
, offset?
): UseQueryResult
<any
, Error
>
Hook to get all the published integrations ids
example
useGetAllIntegrationsIds hook
const availableIntegrationsQuery = useGetAllIntegrationsIds(true);
const availableIntegrations = availableIntegrationsQuery.data
Parameters
Name | Type | Default value |
---|---|---|
enabler | boolean | true |
offset? | number | undefined |
Returns
UseQueryResult
<any
, Error
>
Defined in
ui/hooks/src/use-integration-registry.ts:152
useGetAppConfig
▸ useGetAppConfig(appName
, enabler?
): UseQueryResult
<any
, Error
>
Hook to get configuration object for an installed app
example
useGetAppConfig hook
const appConfigQuery = useGetAppConfig('app name', true);
const appConfig = appConfigQuery.data
Parameters
Name | Type |
---|---|
appName | string |
enabler? | boolean |
Returns
UseQueryResult
<any
, Error
>
Defined in
ui/hooks/src/use-app-settings.ts:24
useGetBookmarks
▸ useGetBookmarks(loggedEthAddress
, enabler?
): UseQueryResult
<Record
<string
, unknown
>[], unknown
>
Hook for gettting a user's saved posts and comments
example
useGetBookmarks hook
const getBookmarksQuery = useGetBookmarks('0x243kb4bret');
const bookmarks = getBookmarksQuery.data;
Parameters
Name | Type | Default value |
---|---|---|
loggedEthAddress | string | undefined |
enabler | boolean | true |
Returns
UseQueryResult
<Record
<string
, unknown
>[], unknown
>
Defined in
ui/hooks/src/use-bookmarks.ts:20
useGetCount
▸ useGetCount(): UseQueryResult
<{ delisted
: number
= 0; kept
: number
= 0; pending
: number
= 0 }, Error
>
Hook to get moderation counters
example
useGetCount hook
const getCountQuery = useGetCount();
const count = getCountQuery.data || { delisted: 0, kept: 0, pending: 0 };
Returns
UseQueryResult
<{ delisted
: number
= 0; kept
: number
= 0; pending
: number
= 0 }, Error
>
Defined in
ui/hooks/src/use-moderation.ts:224
useGetEntryAuthor
▸ useGetEntryAuthor(entryId
): UseQueryResult
<IProfileData
| { _id
: string
; avatar
: { fallbackUrl
: string
; url
: string
} ; coverImage
: { fallbackUrl
: string
; url
: string
} ; creationDate
: string
; default
: [DataProviderInput
] ; description
: string
; ethAddress
: string
; name
: string
; providers
: [DataProviderInput
] ; pubKey
: string
; totalFollowers
: number
; totalFollowing
: number
; totalInterests
: number
; totalPosts
: string
; userName
: string
}, Error
>
Hook to get an entry author's profile data
example
useGetEntryAuthor hook
const getEntryAuthorQuery = useGetEntryAuthor( 'some-entry-id');
const profile = getEntryAuthorQuery.data;
Parameters
Name | Type |
---|---|
entryId | string |
Returns
UseQueryResult
<IProfileData
| { _id
: string
; avatar
: { fallbackUrl
: string
; url
: string
} ; coverImage
: { fallbackUrl
: string
; url
: string
} ; creationDate
: string
; default
: [DataProviderInput
] ; description
: string
; ethAddress
: string
; name
: string
; providers
: [DataProviderInput
] ; pubKey
: string
; totalFollowers
: number
; totalFollowing
: number
; totalInterests
: number
; totalPosts
: string
; userName
: string
}, Error
>
Defined in
ui/hooks/src/use-profile.ts:167
useGetFlags
▸ useGetFlags(entryId
): UseQueryResult
<EntryReport
[], Error
>
Hook to get report flags for a specific entry
example
useGetFlags hook
const getFlagsQuery = useGetFlags('some-entry-id');
const flagEntries = getFlagsQuery.data;
Parameters
Name | Type |
---|---|
entryId | string |
Returns
UseQueryResult
<EntryReport
[], Error
>
Defined in
ui/hooks/src/use-moderation.ts:240
useGetIntegrationId
▸ useGetIntegrationId(integrationName
): UseQueryResult
<{ id
: string
= data }, Error
>
Hook to get integration id by its name
example
useGetIntegrationId hook
const integrationIdQuery = useGetIntegrationId('awesome integration');
const integrationId = integrationIdQuery.data;
Parameters
Name | Type |
---|---|
integrationName | string |
Returns
UseQueryResult
<{ id
: string
= data }, Error
>
Defined in
ui/hooks/src/use-integration-registry.ts:92
useGetIntegrationInfo
▸ useGetIntegrationInfo(integrationId
): UseQueryResult
<IntegrationInfo
, Error
>
Hook to get integration package info
example
useGetIntegrationInfo hook
const integrationInfoQuery = useGetIntegrationInfo('some-integration-id');
const integrationInfo = integrationInfoQuery.data;
Parameters
Name | Type |
---|---|
integrationId | string |
Returns
UseQueryResult
<IntegrationInfo
, Error
>
Defined in
ui/hooks/src/use-integration-registry.ts:24
useGetIntegrationReleaseId
▸ useGetIntegrationReleaseId(integrationName
, version
, enabler?
): UseQueryResult
<{ id
: string
= data }, Error
>
Hook to get integration release id by its name and version
example
useGetIntegrationReleaseId hook
const integrationReleaseIdQuery = useGetIntegrationReleaseId('awesome integration', '0.1.1', true);
const integrationReleaseId = integrationReleaseIdQuery.data;
Parameters
Name | Type |
---|---|
integrationName | string |
version | string |
enabler? | boolean |
Returns
UseQueryResult
<{ id
: string
= data }, Error
>
Defined in
ui/hooks/src/use-integration-registry.ts:114
useGetIntegrationReleaseInfo
▸ useGetIntegrationReleaseInfo(releaseId
): UseQueryResult
<ReleaseInfo
, Error
>
Hook to get integration release info
example
useGetIntegrationReleaseInfo hook
const latestReleaseInfoQuery = useGetIntegrationReleaseInfo('some-release-id');
const latestReleaseInfo = latestReleaseInfoQuery.data
Parameters
Name | Type |
---|---|
releaseId | string |
Returns
UseQueryResult
<ReleaseInfo
, Error
>
Defined in
ui/hooks/src/use-integration-registry.ts:205
useGetIntegrationsCount
▸ useGetIntegrationsCount(): UseQueryResult
<{ totalCount
: any
= data.totalCount }, Error
>
Hook to get the number of published integrations
example
useGetIntegrationsCount hook
const integrationsCountQuery = useGetIntegrationsCount();
const integrationCount = integrationsCountQuery.data;
Returns
UseQueryResult
<{ totalCount
: any
= data.totalCount }, Error
>
Defined in
ui/hooks/src/use-integration-registry.ts:70
useGetIntegrationsInfo
▸ useGetIntegrationsInfo(opt
): UseQueryResult
<{ getIntegrationInfo
: IntegrationInfo
[] }, Error
>
Hook to get package info for multiple integrations by name or id
example
useGetIntegrationsInfo hook
const integrationsInfoQuery = useGetIntegrationsInfo([{ name: 'some-integration-name-1' }, { name: 'some-integration-name-2' }]);
const integrationsInfo = integrationsInfoQuery.data;
Parameters
Name | Type |
---|---|
opt | { id? : string ; name? : string }[] |
Returns
UseQueryResult
<{ getIntegrationInfo
: IntegrationInfo
[] }, Error
>
Defined in
ui/hooks/src/use-integration-registry.ts:47
useGetIntegrationsReleaseInfo
▸ useGetIntegrationsReleaseInfo(releaseIds
): UseQueryResult
<any
[], Error
>
Hook to get multiple integrations release info
example
useGetIntegrationsReleaseInfo hook
const releaseInfoQuery = useGetIntegrationsReleaseInfo(['some-release-id-1', 'some-release-id-2', 'some-release-id-3']);
const releasesInfo = releaseInfoQuery.data
example mock data for an integration to test locally
if (!res.data.getLatestRelease.some(rel => rel.name === '@akashaorg/app-messaging')) {
res.data.getLatestRelease.push({
id: '0x82d31f280645cb2f74a47115a36f1e1b4370eda1812cf4d38d9107996bb60560',
name: '@akashaorg/app-messaging',
version: 'v0.1.0',
integrationType: 0,
sources: [],
integrationID: '0x0f7b806cb610e298f4108f77c5454edafdd48a213ac6df2466816442b2814061',
author: '0xADE0510E72f60789DD17aAFc28629Ee4D9C0Ba72',
enabled: true,
links: {
publicRepository: 'https://github.com/AKASHAorg/akasha-core#readme',
documentation: '',
detailedDescription: '',
},
manifestData: {
mainFile: 'index.js',
license: 'AGPL-3.0',
keywords: [],
description:
'The AKASHA team builds this application so you can privately message friends.',
displayName: 'Messages',
},
createdAt: null,
});
}
Parameters
Name | Type |
---|---|
releaseIds | string [] |
Returns
UseQueryResult
<any
[], Error
>
Defined in
ui/hooks/src/use-integration-registry.ts:262
useGetLatestReleaseInfo
▸ useGetLatestReleaseInfo(opt
): UseQueryResult
<{ getLatestRelease
: ReleaseInfo
[] }, Error
>
Hook to get latest release info for integrations
example
useGetLatestReleaseInfo hook
const latestReleaseInfoQuery = useGetLatestReleaseInfo([{ id: 'some-release-id-1' }, { id: 'some-release-id-2' }, { id: 'some-release-id-3' }]);
const latestReleasesInfo = React.useMemo(() => {
return latestReleaseInfoQuery.data?.getLatestRelease;
}, [latestReleaseInfoQuery.data?.getLatestRelease]);
Parameters
Name | Type |
---|---|
opt | { id? : string ; name? : string }[] |
Returns
UseQueryResult
<{ getLatestRelease
: ReleaseInfo
[] }, Error
>
Defined in
ui/hooks/src/use-integration-registry.ts:288
useGetLogin
▸ useGetLogin(onError?
): UseQueryResult
<LoginState
, unknown
>
Hook for retrieving the current authentication state of the user
example
useGetLogin hook
const loginQuery = useGetLogin();
// can be used with useGetProfile hook to get the logged profile data
const profileDataQuery = useGetProfile(loginQuery.data?.pubKey);
const loggedProfileData = profileDataQuery.data;
Parameters
Name | Type |
---|---|
onError? | (error : Error ) => void |
Returns
UseQueryResult
<LoginState
, unknown
>
Defined in
useGetProfileByIdQuery
▸ useGetProfileByIdQuery(id
): UseQueryResult
<Types.GetProfileByIdQuery
, Error
>
Hook to get a user's profile data by his/her ID.
example
useGetProfileByIdQuery hook
const getProfileQuery = useGetProfileByIdQuery( { id: 'some-ID' },
{
select: data => {
if (data.node && 'profile' in data.node) {
return data.node;
}
return null;
},
},
);
Parameters
Name | Type | Default value |
---|---|---|
id | string | undefined |
Returns
UseQueryResult
<Types.GetProfileByIdQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:769
useInfiniteGetProfileByIdQuery
▸ useInfiniteGetProfileByIdQuery(id
): UseInfiniteQueryResult
<Types.GetProfileByIdQuery
, Error
>
Hook to get a user's profile data by his/her ID (supports infinite scrolling).
example
useInfiniteGetProfileByIdQuery hook
const getProfileQuery = useInfiniteGetProfileByIdQuery('id', { id: 'some-ID' },);
const profileData = React.useMemo(() => {
if (getProfileQuery.data) {
return getProfileQuery.data.pages;
}
return [];
}, [getProfileQuery.data]);
Parameters
Name | Type | Default value |
---|---|---|
id | string | undefined |
Returns
UseInfiniteQueryResult
<Types.GetProfileByIdQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:779
useGetProfileByDidQuery
▸ useGetProfileByDidQuery(id
): UseQueryResult
<Types.GetProfileByDidQuery
, Error
>
Hook to get a user's profile data by his/her DID.
example
useGetProfileByDidQuery hook
const getProfileQuery = useGetProfileByDidQuery(
{ id: 'did:key:some-ID-sequence' },
{
select: data => {
if (data.node && 'profile' in data.node) {
return data.node;
}
return null;
},
},
);
Parameters
Name | Type | Default value |
---|---|---|
id | string | undefined |
Returns
UseQueryResult
<Types.GetProfileByDidQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:811
useInfiniteGetProfileByDidQuery
▸ useInfiniteGetProfileByDidQuery(id
): UseInfiniteQueryResult
<Types.GetProfileByDidQuery
, Error
>
Hook to get a user's profile data by his/her DID (supports infinite scrolling).
example
useInfiniteGetProfileByDidQuery hook
const getProfileQuery = useInfiniteGetProfileByDidQuery('id', { id: 'some-ID' },);
const profileData = React.useMemo(() => {
if (getProfileQuery.data) {
return getProfileQuery.data.pages;
}
return [];
}, [getProfileQuery.data]);
Parameters
Name | Type | Default value |
---|---|---|
id | string | undefined |
Returns
UseInfiniteQueryResult
<Types.GetProfileByDidQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:829
useGetProfilesQuery
▸ useGetProfilesQuery(before?
, after?
, first?
, last?):
UseQueryResult<[
Types.GetProfilesQuery](https://github.com/AKASHAorg/akasha-core/blob/next/typings/src/sdk/graphql-operation-types-new.ts#L162),
Error`>
Hook to get multiple users' profile data.
example
useGetProfilesQuery hook
const getProfilesQuery = useGetProfilesQuery(
{ first: 50 },
{
select: data => data.profileIndex?.edges,
},
);
Parameters
Name | Type |
---|---|
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseQueryResult
<Types.GetProfilesQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:866
useInfiniteGetProfilesQuery
▸ useInfiniteGetProfilesQuery(before?
, after?
, first?
, last?
): UseInfiniteQueryResult
<Types.GetProfilesQuery
, Error
>
Hook to get multiple users' profile data (supports infinite scrolling).
example
useInfiniteGetProfilesQuery hook
// get the last 50 users' profile data
const getProfilesQuery = useInfiniteGetProfilesQuery('last', { last: 50 });
const profilesData = React.useMemo(() => {
if (getProfilesQuery.data) {
return getProfilesQuery.data.pages;
}
return [];
}, [getProfilesQuery.data]);
Parameters
Name | Type |
---|---|
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseInfiniteQueryResult
<Types.GetProfilesQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:884
useGetInterestsQuery
▸ useGetInterestsQuery(id
): UseQueryResult
<Types.GetInterestsQuery
, Error
>
Hook to get interest data.
example
useGetInterestsQuery hook
const getInterestsQuery = useGetInterestsQuery(
{ first: 10 },
{
select: data => data.interestsIndex?.edges,
},
);
Parameters
Name | Type |
---|---|
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseQueryResult
<Types.GetInterestsQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:928
useInfiniteGetInterestsQuery
▸ useInfiniteGetInterestsQuery(before?
, after?
,first?
, last?
): UseInfiniteQueryResult
<Types.GetInterestsQuery
, Error
>
Hook to get interest data (supports infinite scrolling).
example
useInfiniteGetInterestsQuery hook
// get the last 50 interests
const getInterestsQuery = useInfiniteGetInterestsQuery('last', { last: 50 });
const interestsData = React.useMemo(() => {
if (getInterestsQuery.data) {
return getProfilesQuery.data.pages;
}
return [];
}, [getInterestsQuery.data]);
// load more items
const handleLoadMore = React.useCallback(() => {
if (!getInterestsQuery.isLoading && getInterestsQuery.hasNextPage) {
getInterestsQuery.fetchNextPage();
}
}, [getInterestsQuery]);
Parameters
Name | Type |
---|---|
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseInfiniteQueryResult
<Types.GetInterestsQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:946
useGetInterestsByDidQuery
▸ useGetInterestsByDidQuery(id
): UseQueryResult
<Types.GetInterestsByDidQuery
, Error
>
Hook to get interest data by profile's DID.
example
useGetInterestsByDidQuery hook
const getInterestsQuery = useGetInterestsByDidQuery(
{ id: 'did:key:some-key' },
{
select: data => {
if (data.node && 'interests' in data.node) {
return data.node.interests;
}
return null;
},
},
);
Parameters
Name | Type |
---|---|
id | string |
Returns
UseQueryResult
<Types.GetInterestsByDidQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:985
useInfiniteGetInterestsByDidQuery
▸ useInfiniteGetInterestsByDidQuery(id
): UseInfiniteQueryResult
<Types.GetInterestsByDidQuery
, Error
>
Hook to get interest data by profile's DID (supports infinite scrolling).
example
useInfiniteGetInterestsByDidQuery hook
const getInterestsByDidQuery = useInfiniteGetInterestsByDidQuery('id', {
id: 'did:key:some-key',
});
const interestData = React.useMemo(() => {
if (getInterestsByDidQuery.data) {
return getInterestsByDidQuery.data.pages;
}
return [];
}, [getInterestsByDidQuery.data]);
Parameters
Name | Type |
---|---|
id | string |
Returns
UseInfiniteQueryResult
<Types.GetInterestsByDidQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1003
useGetInterestsByIdQuery
▸ useGetInterestsByIdQuery(id
): UseQueryResult
<Types.GetInterestsByIdQuery
, Error
>
Hook to get interest data by profile's ID.
example
useGetInterestsByIdQuery hook
const getInterestsByIdQuery = useGetInterestsByIdQuery(
{ id: 'some-key' },
{
select: data => {
if (data.node && 'interests' in data.node) {
return data.node.interests;
}
return null;
},
},
);
Parameters
Name | Type |
---|---|
id | string |
Returns
UseQueryResult
<Types.GetInterestsByIdQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1039
useInfiniteGetInterestsByIdQuery
▸ useInfiniteGetInterestsByIdQuery(id
): UseInfiniteQueryResult
<Types.GetInterestsByIdQuery
, Error
>
Hook to get interest data by profile's ID (supports infinite scrolling).
example
useInfiniteGetInterestsByIdQuery hook
const getInterestsByIdQuery = useInfiniteGetInterestsByIdQuery(
'id',
{ id: 'some-key' },
)
const InterestsByIdData = React.useMemo(() => {
if (getInterestsByIdQuery.data) {
return getInterestsByIdQuery.data.pages;
}
return [];
}, [getInterestsByIdQuery.data]);
// load more
const handleLoadMore = React.useCallback(() => {
if (!getInterestsByIdQuery.isLoading && getInterestsByIdQuery.hasNextPage) {
getInterestsByIdQuery.fetchNextPage();
}
}, [getInterestsByIdQuery]);
Parameters
Name | Type |
---|---|
id | string |
Returns
UseInfiniteQueryResult
<Types.GetInterestsByIdQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1065
useGetFollowingListByDidQuery
▸ useGetFollowingListByDidQuery(id
, before?
, after?
, first?
, last?
): UseQueryResult
<Types.GetFollowingListByDidQuery
, Error
>
Hook to get a list of people a profile (identified by its ID) is following.
example
useGetFollowingListByDidQuery hook
const getFollowingListBydQuery = useGetFollowingListByDidQuery(
{ id: 'did:key:some-key' },
{
select: data => {
if (data.node && 'followList' in data.node) {
return data.node.followList.edges;
}
return null;
},
},
);
Parameters
Name | Type |
---|---|
id | string |
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseQueryResult
<Types.GetFollowingListByDidQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1110
useInfiniteGetFollowingListByDidQuery
▸ useInfiniteGetFollowingListByDidQuery(id
, before?
, after?
, first?
, last?
): UseInfiniteQueryResult
<Types.GetFollowingListByDidQuery
, Error
>
Hook to get interest data by profile's ID (supports infinite scrolling).
example
useInfiniteGetFollowingListByDidQuery hook
const getFollowingListByDidQuery = useInfiniteGetFollowingListByDidQuery(
'id',
{ id: 'did:key:some-did-key' },
)
const followingListData = React.useMemo(() => {
if (getFollowingListByDidQuery.data) {
return getFollowingListByDidQuery.data.pages;
}
return [];
}, [getFollowingListByDidQuery.data]);
// load more
const handleLoadMore = React.useCallback(() => {
if (!getFollowingListByDidQuery.isLoading && getFollowingListByDidQuery.hasNextPage) {
getFollowingListByDidQuery.fetchNextPage();
}
}, [getFollowingListByDidQuery]);
Parameters
Name | Type |
---|---|
id | string |
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseInfiniteQueryResult
<Types.GetInterestsByIdQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1128
useGetFollowersListByDidQuery
▸ useGetFollowersListByDidQuery(id
, before?
, after?
, first?
, last?
): UseQueryResult
<Types.GetFollowersListByDidQuery
, Error
>
Hook to get a list of followers for a profile (identified by its DID).
example
useGetFollowersListByDidQuery hook
const getFollowerListBydQuery = useGetFollowersListByDidQuery(
{ id: 'did:key:some-key' },
{
select: data => {
if (data.node && 'profile' in data.node) {
return data.node.profile.followers.edges;
}
return null;
},
},
);
Parameters
Name | Type |
---|---|
id | string |
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseQueryResult
<Types.GetFollowersListByDidQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1175
useInfiniteGetFollowersListByDidQuery
▸ useInfiniteGetFollowersListByDidQuery(id
, before?
, after?
, first?
, last?
): UseInfiniteQueryResult
<Types.GetFollowersListByDidQuery
, Error
>
Hook to get interest data by profile's ID (supports infinite scrolling).
example
useInfiniteGetFollowersListByDidQuery hook
const getFollowerListByDidQuery = useInfiniteGetFollowersListByDidQuery(
'id',
{ id: 'did:key:some-did-key' },
)
const followerListData = React.useMemo(() => {
if (getFollowerListByDidQuery.data) {
return getFollowerListByDidQuery.data.pages;
}
return [];
}, [getFollowerListByDidQuery.data]);
// load more
const handleLoadMore = React.useCallback(() => {
if (!getFollowerListByDidQuery.isLoading && getFollowerListByDidQuery.hasNextPage) {
getFollowerListByDidQuery.fetchNextPage();
}
}, [getFollowerListByDidQuery]);
Parameters
Name | Type |
---|---|
id | string |
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseInfiniteQueryResult
<Types.GetFollowersListByDidQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1193
useGetMyProfileQuery
▸ useGetMyProfileQuery(): UseQueryResult
<Types.GetMyProfileQuery
, Error
>
Hook to get the currently logged-in profile.
example
useGetMyProfileQuery hook
const profileDataReq = useGetMyProfileQuery(null, {
select: resp => {
return resp.viewer?.profile;
},
});
Parameters
Name | Type |
---|
Returns
UseQueryResult
<Types.GetMyProfileQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1222
useInfiniteGetMyProfileQuery
▸ useInfiniteGetMyProfileQuery(): UseInfiniteQueryResult
<Types.GetMyProfileQuery
, Error
>
Hook to get the currently logged-in profile (supports infinite scrolling).
example
useInfiniteGetMyProfileQuery hook
const profileDataReq = useInfiniteGetMyProfileQuery(0);
const profileData = React.useMemo(() => {
if (profileDataReq.data) {
return profileDataReq.data.pages;
}
return [];
}, [profileDataReq.data]);
Parameters
Name | Type |
---|
Returns
UseInfiniteQueryResult
<Types.GetMyProfileQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1240
useCreateProfileMutation
▸ useCreateProfileMutation(i
): UseMutationResult
<Types.CreateProfileMutation
, unknown
>
Hook to create a new profile.
example
useCreateProfileMutation hook
const createProfile = useCreateProfileMutation();
const profileData = {
content: {
avatar: {
default: {
height: 210,
src: 'http://some-url.com',
width: 210,
},
},
background: {
default: {
height: 210,
src: 'http://some-url.com',
width: 210,
}
},
createdAt: Date.now(),
description: 'A simple description/bio',
links: [
{
href: 'http://some-url.com',
label: 'Ethereum',
}
],
name: 'Mr.Cat',
},
};
createProfile.mutate({
i: profileData,
});
Parameters
Name | Type |
---|---|
i | CreateProfileInput |
Returns
UseMutationResult
<Types.CreateProfileMutation
, unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1270
useUpdateProfileMutation
▸ useUpdateProfileMutation(i
): UseMutationResult
<Types.UpdateProfileMutation
, unknown
>
Hook to update data for a profile.
example
useUpdateProfileMutation hook
const updateProfile = useUpdateProfileMutation();
const profileData = {
id: 'profile-id',
content: {
avatar: {
default: {
height: 210,
src: 'http://some-url.com',
width: 210,
},
},
background: {
default: {
height: 210,
src: 'http://some-url.com',
width: 210,
}
},
createdAt: Date.now(),
description: 'A simple description/bio',
links: [
{
href: 'http://some-url.com',
label: 'Ethereum',
}
],
name: 'Mr.Cat',
},
};
updateProfile.mutate({
i: profileData,
});
Parameters
Name | Type |
---|---|
i | UpdateProfileInput |
Returns
UseMutationResult
<Types.UpdateProfileMutation
, unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1292
useCreateInterestsMutation
▸ useCreateInterestsMutation(i
): UseMutationResult
<Types.CreateInterestsMutation
, unknown
>
Hook to create interest data for a profile.
example
useCreateInterestsMutation hook
const createInterests = useCreateInterestsMutation();
const interestsData = {
content: {
topics: [
{
labelType: 'example-label-type',
value: 'example label value',
}
]
},
};
createInterests.mutate({
i: interestsData,
});
Parameters
Name | Type |
---|---|
i | CreateInterestsInput |
Returns
UseMutationResult
<Types.CreateInterestsMutation
, unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1321
useUpdateInterestsMutation
▸ useUpdateInterestsMutation(i
): UseMutationResult
<Types.UpdateInterestsMutation
, unknown
>
Hook to update interest data for a profile.
example
useUpdateInterestsMutation hook
const updateInterests = useUpdateInterestsMutation();
const interestsData = {
id: 'some-id',
content: {
topics: [
{
labelType: 'example-label-type',
value: 'example label value',
}
]
},
};
updateInterests.mutate({
i: interestsData,
});
Parameters
Name | Type |
---|---|
i | UpdateInterestsInput |
Returns
UseMutationResult
<Types.UpdateInterestsMutation
, unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1350
useCreateFollowMutation
▸ useCreateFollowMutation(i
): UseMutationResult
<Types.CreateFollowMutation
, unknown
>
Hook to create follow data for a profile.
example
useCreateFollowMutation hook
const createFollow = useCreateFollowMutation();
const followData = {
content: {
isFollowing: true,
profileID: 'CeramicStreamID',
},
};
createFollow.mutate({
i: followData,
});
Parameters
Name | Type |
---|---|
i | CreateFollowInput |
Returns
UseMutationResult
<Types.CreateFollowMutation
, unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1378
useUpdateFollowMutation
▸ useUpdateFollowMutation(i
): UseMutationResult
<Types.UpdateFollowMutation
, unknown
>
Hook to update follow data for a profile.
example
useCreateFollowMutation hook
const updateFollow = useUpdateFollowMutation();
const followData = {
id: 'some-id',
content: {
isFollowing: true,
profileID: 'CeramicStreamID',
},
};
updateFollow.mutate({
i: followData,
});
Parameters
Name | Type |
---|---|
i | UpdateFollowInput |
Returns
UseMutationResult
<Types.UpdateFollowMutation
, unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:1406
useGetTag
▸ useGetTag(tagName
, enabler?
): UseQueryResult
<Tag_Response
, Error
>
Hook to get a specific tag by name
example
useGetTag hook
const getTagQuery = useGetTag('awesometag', true);
const tag = getTagQuery.data
Parameters
Name | Type | Default value |
---|---|---|
tagName | string | undefined |
enabler | boolean | true |
Returns
UseQueryResult
<Tag_Response
, Error
>
Defined in
useGlobalLogin
▸ useGlobalLogin(props
): void
Hook that will fire an action when the sign in is called
example
useGlobalLogin hook
useGlobalLogin({
onLogin: payload => {},
onLogout: () => {},
waitForAuth: payload => {}.
onReady: payload => {},
onLoadFromCache: payload => {},
onError: payload => {},
})
Parameters
Name | Type |
---|---|
props | UseGlobalLoginProps |
Returns
void
Defined in
ui/hooks/src/use-global-login.ts:34
useInfiniteDelisted
▸ useInfiniteDelisted(limit
, offset?
): UseInfiniteQueryResult
<ModeratedItemsReponse
, Error
>
Hook to get delisted moderated items
example
useInfiniteDelisted hook
const infiniteDelistedQuery = useInfiniteDelisted(10);
const delistedItemPages = React.useMemo(() => {
if (infiniteDelistedQuery.data) {
return infiniteDelistedQuery.data.pages;
}
return [];
}, [infiniteDelistedQuery.data]);
// load more items
const handleLoadMore = React.useCallback(() => {
if (!infiniteDelistedQuery.isLoading && infiniteDelistedQuery.hasNextPage) {
infiniteDelistedQuery.fetchNextPage();
}
}, [infiniteDelistedQuery]);
Parameters
Name | Type |
---|---|
limit | number |
offset? | string |
Returns
UseInfiniteQueryResult
<ModeratedItemsReponse
, Error
>
Defined in
ui/hooks/src/use-moderation.ts:383
useInfiniteKept
▸ useInfiniteKept(limit
, offset?
): UseInfiniteQueryResult
<ModeratedItemsReponse
, Error
>
Hook to get kept moderated items
example
useInfiniteKept hook
const infiniteKeptQuery = useInfiniteKept(10);
const keptItemPages = React.useMemo(() => {
if (infiniteKeptQuery.data) {
return infiniteKeptQuery.data.pages;
}
return [];
}, [infiniteKeptQuery.data]);
// load more items
const handleLoadMore = React.useCallback(() => {
if (!infiniteKeptQuery.isLoading && infiniteKeptQuery.hasNextPage) {
infiniteKeptQuery.fetchNextPage();
}
}, [infiniteKeptQuery]);
Parameters
Name | Type |
---|---|
limit | number |
offset? | string |
Returns
UseInfiniteQueryResult
<ModeratedItemsReponse
, Error
>
Defined in
ui/hooks/src/use-moderation.ts:343
useInfiniteLog
▸ useInfiniteLog(limit
, offset?
): UseInfiniteQueryResult
<LogItemsReponse
, Error
>
Hook to get log of moderated items
example
useInfiniteLog hook
const infiniteLogQuery = useInfiniteLog(10);
const logItemPages = React.useMemo(() => {
if (infiniteLogQuery.data) {
return infiniteLogQuery.data.pages;
}
return [];
}, [infiniteLogQuery.data]);
// load more items
const handleLoadMore = React.useCallback(() => {
if (!infiniteLogQuery.isLoading && infiniteLogQuery.hasNextPage) {
infiniteLogQuery.fetchNextPage();
}
}, [infiniteLogQuery]);
Parameters
Name | Type |
---|---|
limit | number |
offset? | string |
Returns
UseInfiniteQueryResult
<LogItemsReponse
, Error
>
Defined in
ui/hooks/src/use-moderation.ts:269
useInfinitePending
▸ useInfinitePending(limit
, offset?
): UseInfiniteQueryResult
<PendingItemsReponse
, Error
>
Hook to get pending moderation items
example
useInfinitePending hook
const infinitePendingQuery = useInfinitePending(10);
const pendingItemPages = React.useMemo(() => {
if (infinitePendingQuery.data) {
return infinitePendingQuery.data.pages;
}
return [];
}, [infinitePendingQuery.data]);
// load more items
const handleLoadMore = React.useCallback(() => {
if (!infinitePendingQuery.isLoading && infinitePendingQuery.hasNextPage) {
infinitePendingQuery.fetchNextPage();
}
}, [infinitePendingQuery]);
Parameters
Name | Type |
---|---|
limit | number |
offset? | string |
Returns
UseInfiniteQueryResult
<PendingItemsReponse
, Error
>
Defined in
ui/hooks/src/use-moderation.ts:308
useGetBeamsQuery
▸ useGetBeamsQuery(after?
, before?
, first?
, last?
): UseQueryResult
<Types.GetBeamsQuery
, Error
>
Hook to get available beams.
example
useGetBeamsQuery hook
// get the first 10 beams
const beamsQuery = useGetBeamsQuery( { first: 10 }, { select: response => response.beamIndex });
// get the last 10 beams
const beamsQuery = useGetBeamsQuery( { last: 10 }, { select: response => response.beamIndex });
Parameters
Name | Type |
---|---|
after? | string |
before? | string |
first? | number |
last? | number |
Returns
UseQueryResult
<Types.GetBeamsQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:122
useInfiniteGetBeamsQuery
▸ useInfiniteGetBeamsQuery(after?
, before?
, first?
, last?
): UseInfiniteQueryResult
<Types.GetBeamsQuery
, Error
>
Hook to get available beams (supports infinite scrolling).
example
useInfiniteGetBeamsQuery hook
// get the first 50 beams
const beamsQuery = useInfiniteGetBeamsQuery('first', { first: 50 })
const beams = React.useMemo(() => {
if (beamsQuery.data) {
return beamsQuery.data.pages;
}
return [];
}, [beamsQuery.data]);
// load more if there's a next page
const handleLoadMore = React.useCallback(() => {
if (!beamsQuery.isLoading && beamsQuery.hasNextPage) {
beamsQuery.fetchNextPage();
}
}, [beamsQuery]);
Parameters
Name | Type |
---|---|
after? | string |
before? | string |
first? | number |
last? | number |
Returns
UseInfiniteQueryResult
<Types.GetBeamsQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:140
useGetBeamsByAuthorDidQuery
▸ useGetBeamsByAuthorDidQuery(id
, after?
, before?
, first?
, last?
): UseQueryResult
<{} | {isViewer
: boolean
; beamList?
: { edges?
: { node?
: { id
: string
; reflectionsCount
: number
; active
: boolean
; tags?
: <string | null> | null
[]; version
: any
; author
: {id
: string
}; content
: {property
: string
; provider
: string
; value
: string
}[]; } []; pageInfo
: {...};}}}, Error
>
Hook to get beams by DID.
example
useGetBeamsByAuthorDidQuery hook
const beams = useGetBeamsByAuthorDidQuery(
{ id: 'did:key:z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK' },
{ select: response => response.node },
);
Parameters
Name | Type |
---|---|
id | string |
after? | string |
before? | string |
first? | number |
last? | number |
Returns
UseQueryResult
<{} | {isViewer
: boolean
; beamList?
: { edges?
: { node?
: { id
: string
; reflectionsCount
: number
; active
: boolean
; tags?
: <string | null> | null
[]; version
: any
; author
: {id
: string
}; content
: {property
: string
; provider
: string
; value
: string
}[]; } []; pageInfo
: {...};}}}, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:182
useInfiniteGetBeamsByAuthorDidQuery
▸ useInfiniteGetBeamsByAuthorDidQuery(id
, after?
, before?
, first?
, last?
): UseInfiniteQueryResult
<{ nextIndex
: string
; results
: string
[] ; total
: number
}, Error
>
Hook to get beams from an author identified by DID (supports infinite scrolling).
example
useInfiniteGetBeamsByAuthorDidQuery hook
// get the last 30 beams by account with DID z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK
const beamsReq = useInfiniteGetBeamsByAuthorDidQuery('last', { last: 30, id: 'z6MkhaXgBZDvotDkL5257faiztiGiC2QtKLGpbnnEGta2doK' });
const fetchedBeams = React.useMemo(() => {
if (beamsReq.data) {
return beamsReq.data.pages;
}
return [];
}, [beamsReq.data]);
// load more if there's a next page
const handleLoadMore = React.useCallback(() => {
if (!beamsReq.isLoading && beamsReq.hasNextPage) {
beamsReq.fetchNextPage();
}
}, [beamsReq]);
Parameters
Name | Type |
---|---|
id | string |
after? | string |
before? | string |
first? | number |
last? | number |
Returns
UseInfiniteQueryResult
<{ nextIndex
: string
; results
: string
[] ; total
: number
}, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:200
useGetBeamByIdQuery
▸ useGetBeamByIdQuery(id
): UseQueryResult
<{ node?
: {} | { id
: string
; reflectionsCount
: number
; active
: boolean
; tags?
: <string | null> | null
[]; version
: any
; author
: {id
: string
}; content
: {property
: string
; provider
: string
; value
: string
}[]; } []}, Error
>
Hook to get a single beam by its ID.
example
useGetBeamByIdQuery hook
// get beam by ID 123456789
const beam = useGetBeamByIdQuery(
{ id: '123456789' },
{
select: data => data.node,
},
);
Parameters
Name | Type |
---|---|
id | string |
Returns
UseQueryResult
<{ node?
: {} | { id
: string
; reflectionsCount
: number
; active
: boolean
; tags?
: <string | null> | null
[]; version
: any
; author
: {id
: string
}; content
: {property
: string
; provider
: string
; value
: string
}[]; } []}, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:229
useInfiniteGetBeamByIdQuery
▸ useInfiniteGetBeamByIdQuery(id
): UseInfiniteQueryResult
<{ nextIndex
: string
; results
: string
[] ; total
: number
}, Error
>
Hook to get a beam by its ID (supports infinite scrolling).
example
useInfiniteGetBeamByIdQuery hook
// get beam by ID 123456789
const beamReq = useInfiniteGetBeamByIdQuery(
'id',
{ id: '123456789' },
);
const beam = React.useMemo(() => {
if (beamReq.data) {
return beamReq.data.pages;
}
return [];
}, [beamReq.data]);
Parameters
Name | Type |
---|---|
id | string |
Returns
UseInfiniteQueryResult
<{ nextIndex
: string
; results
: string
[] ; total
: number
}, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:247
useGetRebeamsFromBeamQuery
▸ useGetRebeamsFromBeamQuery(id
): UseQueryResult
<{ node?
: {} | {rebeams
: {edges?
: {node?
: {quotedBeam?
: {id
: string
; reflectionsCount
: number
; rebeamsCount
: number
; active
: boolean
; tags?
: string
[]; version
: any
; author
: {id
: string
}; content
: {property
: string
; provider
: string
; value
: string
}[];}; beam?
: { ...; };};}[];};}; }, Error
>
Hook to get rebeams for a beam identified by its ID.
example
useGetRebeamsFromBeamQuery hook
// get rebeams for beam with ID 123456789
const rebeamReq = useGetRebeamsFromBeamQuery({ id: '123456789' }, { select: data => data.node });
Parameters
Name | Type |
---|---|
id | string |
Returns
UseQueryResult
<{ node?
: {} | {rebeams
: {edges?
: {node?
: {quotedBeam?
: {id
: string
; reflectionsCount
: number
; rebeamsCount
: number
; active
: boolean
; tags?
: string
[]; version
: any
; author
: {id
: string
}; content
: {property
: string
; provider
: string
; value
: string
}[];}; beam?
: { ...; };};}[];};}; }, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:287
useInfiniteGetRebeamsFromBeamQuery
▸ useInfiniteGetRebeamsFromBeamQuery(id
): UseInfiniteQueryResult
< Types.GetRebeamsFromBeamQuery
, Error
>
Hook to get rebeams for a beam identified by its ID (support infinite scrolling).
example
useInfiniteGetRebeamsFromBeamQuery hook
// get rebeams for beam with ID 123456789
const rebeamsReq = useInfiniteGetRebeamsFromBeamQuery(
'id',
{ id: '123456789' },
);
const rebeams = React.useMemo(() => {
if (rebeamReq.data) {
return rebeamReq.data.pages;
}
return [];
}, [rebeamReq.data]);
// load more
const handleLoadMore = React.useCallback(() => {
if (!rebeamReq.isLoading && rebeamReq.hasNextPage) {
rebeamReq.fetchNextPage();
}
}, [rebeamReq]);
Parameters
Name | Type |
---|---|
id | string |
Returns
UseInfiniteQueryResult
< Types.GetRebeamsFromBeamQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:305
useGetMentionsFromBeamQuery
▸ useGetMentionsFromBeamQuery(id
): UseQueryResult
<Types.GetMentionsFromBeamQuer
, Error
>
Hook to get mentions for a beam identified by its ID.
example
useGetMentionsFromBeamQuery hook
// get mentions for beam with ID 123456789
const mentions = useGetMentionsFromBeamQuery(
{ id: '123456789' },
{ select: data => data.node }
);
Parameters
Name | Type |
---|---|
id | string |
Returns
UseQueryResult
< Types.GetMentionsFromBeamQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:346
useInfiniteGetMentionsFromBeamQuery
▸ useInfiniteGetMentionsFromBeamQuery(id
): UseInfiniteQueryResult
<Types.GetMentionsFromBeamQuery
, Error
>
Hook to get mentions for a beam identified by its ID (supports infinite scrolling).
example
useInfiniteGetMentionsFromBeamQuery hook
// get mentions for beam with ID 123456789
const mentionsReq = useGetMentionsFromBeamQuery(
'id',
{ id: '123456789' },
);
const mentions = React.useMemo(() => {
if (mentionsReq.data) {
return mentionsReq.data.pages;
}
return [];
}, [mentionsReq.data]);
// load more
const handleLoadMore = React.useCallback(() => {
if (!mentionsReq.isLoading && mentionsReq.hasNextPage) {
mentionsReq.fetchNextPage();
}
}, [mentionsReq]);
Parameters
Name | Type |
---|---|
id | string |
Returns
UseInfiniteQueryResult
< Types.GetMentionsFromBeamQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:364
useCreateBeamMutation
▸ useCreateBeamMutation(i
): UseMutationResult
<Types.CreateBeamMutation
, unknown
>
Hook to create a new beam.
example
useCreateBeamMutation hook
const createBeam = useCreateBeamMutation();
const beamData = {
content: {
active: true,
content: [
{
property: 'test',
provider: 'test',
value: 'test',
},
],
createdAt: Date.now(),
},
};
createBeam.mutate({
i: beamData,
});
Parameters
Name | Type |
---|---|
i | CreateBeamInput |
Returns
UseMutationResult
<Types.CreateBeamMutation
, unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:393
useUpdateBeamMutation
▸ useUpdateBeamMutation(i
): UseMutationResult
<Types.UpdateBeamMutation
, unknown
>
Hook to update an existing beam.
example
useUpdateBeamMutation hook
const updateBeamMutation = useUpdateBeamMutation();
// updated data for beam ID 1234
const beamData = {
id: '1234',
content: {
active: true,
content: [
{
property: 'test',
provider: 'test',
value: 'test',
},
],
createdAt: Date.now(),
},
};
// call the mutate function to update
updateBeamMutation.mutate({
i: beamData,
});
Parameters
Name | Type |
---|---|
i | UpdateBeamInput |
Returns
UseMutationResult
<Types.UpdateBeamMutation
, unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:415
useCreateRebeamMutation
▸ useCreateRebeamMutation(i
): UseMutationResult
<[Types.CreateRebeamMutation
] (https://github.com/AKASHAorg/akasha-core/blob/next/typings/src/sdk/graphql-operation-types-new.ts#L66), unknown
>
Hook to create a rebeam for a beam.
example
useCreateRebeamMutation hook
const createRebeamMutation = useCreateRebeamMutation();
const beamData = {
content: {
active: true,
beamID: 'CeramicStreamID',
quotedBeamID: 'CeramicStreamID',
},
};
createRebeamMutation.mutate({
i: beamData,
});
Parameters
Name | Type |
---|---|
i | CreateRebeamInput |
Returns
UseMutationResult
<[Types.CreateRebeamMutation
] (https://github.com/AKASHAorg/akasha-core/blob/next/typings/src/sdk/graphql-operation-types-new.ts#L66), unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:443
useCreateBeamProfileMentionMutation
▸ useCreateBeamProfileMentionMutation(i
): UseMutationResult
<Types.CreateBeamProfileMentionMutation
, unknown
>
Hook to create a mention for a profile from a beam.
example
useCreateBeamProfileMentionMutation hook
const createBeamProfileMention = useCreateBeamProfileMentionMutation();
const mentionData = {
content: {
beamID: 'CeramicStreamID',
profileID: 'CeramicStreamID',
},
};
createBeamProfileMention.mutate({
i: mentionData,
});
Parameters
Name | Type |
---|---|
i | CreateProfileMentionInput |
Returns
UseMutationResult
<Types.CreateBeamProfileMentionMutation
, unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:470
useGetReflectionsFromBeamQuery
▸ useGetReflectionsFromBeamQuery(id
): UseQueryResult
<Types.GetReflectionsFromBeamQuery
, Error
>
Hook to get reflections of a beam identified by its ID.
example
useGetReflectionsFromBeamQuery hook
// get the reflecions for a beam with ID 123456789
const reflections = useGetReflectionsFromBeamQuery(
{ id: '123456789' },
{
select: data => data.node,
},
);
Parameters
Name | Type |
---|---|
id | string |
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseQueryResult
<Types.GetReflectionsFromBeamQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:503
useInfiniteGetReflectionsFromBeamQuery
▸ useInfiniteGetReflectionsFromBeamQuery(id
): UseInfiniteQueryResult
<Types.GetReflectionsFromBeamQuery
, Error
>
Hook to get reflections of a beam identified by its ID (supports infinite scrolling).
example
useInfiniteGetReflectionsFromBeamQuery hook
// get the reflecions for a beam with ID 123456789
const reflectionsReq = useInfiniteGetReflectionsFromBeamQuery(
'id',
{ id: '123456789' },
);
const reflections = React.useMemo(() => {
if (reflectionsReq.data) {
return reflectionsReq.data.pages;
}
return [];
}, [reflectionsReq.data]);
// load more
const handleLoadMore = React.useCallback(() => {
if (!reflectionsReq.isLoading && reflectionsReq.hasNextPage) {
reflectionsReq.fetchNextPage();
}
}, [reflectionsReq]);
Parameters
Name | Type |
---|---|
id | string |
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseInfiniteQueryResult
<Types.GetReflectionsFromBeamQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:521
useGetReflectionsByAuthorDidQuery
▸ useGetReflectionsByAuthorDidQuery(id
): UseQueryResult
<Types.GetReflectionsByAuthorDidQuery
, Error
>
Hook to get reflections belonging to a member identified by their DID.
example
useGetReflectionsByAuthorDidQuery hook
// get the reflecions of a member with DID did:key::123456789
const reflections = useGetReflectionsByAuthorDidQuery(
{ id: 'did:key::123456789' },
{
select: data => data.node,
},
);
Parameters
Name | Type |
---|---|
id | string |
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseQueryResult
<Types.GetReflectionsByAuthorDidQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:563
useInfiniteGetReflectionsByAuthorDidQuery
▸ useInfiniteGetReflectionsByAuthorDidQuery(id
): UseQueryResult
<Types.GetReflectionsByAuthorDidQuery
, Error
>
Hook to get reflections belonging to a member identified by their DID (supports infinite scrolling).
example
useInfiniteGetReflectionsByAuthorDidQuery hook
// get the reflecions of a member with DID did:key::123456789
const reflectionsReq = useInfiniteGetReflectionsByAuthorDidQuery(
'id',
{ id: 'did:key::123456789' },
);
const reflections = React.useMemo(() => {
if (reflectionsReq.data) {
return reflectionsReq.data.pages;
}
return [];
}, [reflectionsReq.data]);
// load more
const handleLoadMore = React.useCallback(() => {
if (!reflectionsReq.isLoading && reflectionsReq.hasNextPage) {
reflectionsReq.fetchNextPage();
}
}, [reflectionsReq]);
Parameters
Name | Type |
---|---|
id | string |
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseQueryResult
<Types.GetReflectionsByAuthorDidQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:581
useGetReflectReflectionsQuery
▸ useGetReflectReflectionsQuery(id
): UseQueryResult
<Types.GetReflectReflectionsQuery
, Error
>
Hook to get the reflects of a reflection.
example
useGetReflectReflectionsQuery hook
// get the reflect of a reflection with ID 123456789
const reflectionReflects = useGetReflectReflectionsQuery(
{ id: '123456789' },
{
select: data => data.node,
},
);
Parameters
Name | Type |
---|---|
id | string |
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseQueryResult
<Types.GetReflectReflectionsQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:624
useInfiniteGetReflectReflectionsQuery
▸ useInfiniteGetReflectReflectionsQuery(id
): UseInfiniteQueryResult
<Types.GetReflectReflectionsQuery
, Error
>
Hook to get the reflects of a reflection (supports infinite scrolling).
example
useInfiniteGetReflectReflectionsQuery hook
// get the reflects of a reflection with ID 123456789
const reflectionReflectsReq = useInfiniteGetReflectReflectionsQuery(
'id',
{ id: '123456789' },
);
const reflectionsReflects = React.useMemo(() => {
if (reflectionReflectsReq.data) {
return reflectionReflectsReq.data.pages;
}
return [];
}, [reflectionReflectsReq.data]);
// load more
const handleLoadMore = React.useCallback(() => {
if (!reflectionReflectsReq.isLoading && reflectionReflectsReq.hasNextPage) {
reflectionReflectsReq.fetchNextPage();
}
}, [reflectionReflectsReq]);
Parameters
Name | Type |
---|---|
id | string |
before? | string |
after? | string |
first? | number |
last? | number |
Returns
UseInfiniteQueryResult
<Types.GetReflectReflectionsQuery
, Error
>
Defined in
ui/hooks/src/generated/hooks-new.ts:642
useCreateReflectMutation
▸ useCreateReflectMutation(i
): UseMutationResult
<Types.CreateReflectMutation
, unknown
>
Hook to create a reflect.
example
useCreateReflectMutation hook
const createReflect = useCreateReflectMutation();
// example of a reflect's data
const reflectData = {
content: {
active: true,
beamID: 'CeramicStreamID',
content: {
property: 'test',
provider: 'test',
value: 'test',
},
createdAt: Date.now(),
isReply: true
},
};
createReflect.mutate({
i: reflectData,
});
Parameters
Name | Type |
---|---|
i | CreateReflectInput |
Returns
UseMutationResult
<Types.CreateReflectMutation
, unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:672
useUpdateReflectMutation
▸ useUpdateReflectMutation(i
): UseMutationResult
<Types.UpdateReflectMutation
, unknown
>
Hook to update a reflect.
example
useUpdateReflectMutation hook
const updateReflect = useUpdateReflectMutation();
// example of a reflect's data
const reflectData = {
id: 'some-id',
content: {
active: true,
beamID: 'CeramicStreamID',
content: {
property: 'test',
provider: 'test',
value: 'test',
},
createdAt: Date.now(),
isReply: true
},
};
updateReflect.mutate({
i: reflectData,
});
Parameters
Name | Type |
---|---|
i | UpdateReflectInput |
Returns
UseMutationResult
<Types.UpdateReflectMutation
, unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:694
useCreateReflectReflectionMutation
▸ useCreateReflectReflectionMutation(i
): UseMutationResult
<Types.CreateReflectReflectionMutation
, unknown
>
Hook to create a reflect of a reflect.
example
useCreateReflectReflectionMutation hook
const createReflect = useCreateReflectReflectionMutation();
// example of a reflect's data
const reflectData = {
content: {
active: true,
reflectID: 'CeramicStreamID',
reflectionID: 'CeramicStreamID',
},
};
createReflect.mutate({
i: reflectData,
});
Parameters
Name | Type |
---|---|
i | CreateReflectionInput |
Returns
UseMutationResult
<Types.CreateReflectReflectionMutation
, unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:721
useUpdateReflectReflectionMutation
▸ useUpdateReflectReflectionMutation(i
): UseMutationResult
<Types.UpdateReflectReflectionMutation
, unknown
>
Hook to update a reflect of a reflection.
example
useUpdateReflectReflectionMutation hook
const createReflect = useUpdateReflectReflectionMutation();
// example of a reflect's data
const reflectData = {
id: '1234',
content: {
active: true,
reflectID: 'CeramicStreamID',
reflectionID: 'CeramicStreamID',
},
};
createReflect.mutate({
i: reflectData,
});
Parameters
Name | Type |
---|---|
i | UpdateReflectionInput |
Returns
UseMutationResult
<Types.UpdateReflectReflectionMutation
, unknown
>
Defined in
ui/hooks/src/generated/hooks-new.ts:748
useInfinitePostsByAuthor
▸ useInfinitePostsByAuthor(pubKey
, limit
, enabled?
, offset?
): UseInfiniteQueryResult
<{ nextIndex
: string
; results
: string
[] ; total
: number
}, Error
>
Hook to get an author's posts
example
useInfinitePostsByAuthor hook
const authorPostsQuery = useInfinitePostsByAuthor('author-public-key', 15);
const postPages = React.useMemo(() => {
if (authorPostsQuery.data) {
return authorPostsQuery.data.pages;
}
return [];
}, [authorPostsQuery.data]);
// load more posts
const handleLoadMore = React.useCallback(() => {
if (!authorPostsQuery.isLoading && authorPostsQuery.hasNextPage && loginState?.fromCache) {
authorPostsQuery.fetchNextPage();
}
}, [authorPostsQuery, loginState?.fromCache]);
Parameters
Name | Type | Default value |
---|---|---|
pubKey | string | undefined |
limit | number | undefined |
enabled | boolean | true |
offset? | number | undefined |
Returns
UseInfiniteQueryResult
<{ nextIndex
: string
; results
: string
[] ; total
: number
}, Error
>
Defined in
useInfinitePostsByTag
▸ useInfinitePostsByTag(tagName
, limit
, offset?
): UseInfiniteQueryResult
<{ nextIndex
: string
; results
: string
[] ; total
: number
}, Error
>
Hook to get posts that contain a specific tag
example
useInfinitePostsByTag hook
const tagPostsQuery = useInfinitePostsByTag('awesometag', 15);
const postPages = React.useMemo(() => {
if (tagPostsQuery.data) {
return tagPostsQuery.data.pages;
}
return [];
}, [tagPostsQuery.data]);
// load more posts
const handleLoadMore = React.useCallback(() => {
if (!tagPostsQuery.isLoading && tagPostsQuery.hasNextPage && loginState?.fromCache) {
tagPostsQuery.fetchNextPage();
}
}, [tagPostsQuery, loginState?.fromCache]);
Parameters
Name | Type |
---|---|
tagName | string |
limit | number |
offset? | string |
Returns
UseInfiniteQueryResult
<{ nextIndex
: string
; results
: string
[] ; total
: number
}, Error
>
Defined in
useInjectedProvider
▸ useInjectedProvider(): UseQueryResult
<{ details
: { iconType
: string
= ''; subtitleLabel
: string
= ''; titleLabel
: string
= '' } ; name
: INJECTED_PROVIDERS
= INJECTED_PROVIDERS.NOT_DETECTED }, Error
>
A hook to get injected provider from the SDK
example
useInjectedProvider hook
const injectedProviderQuery = useInjectedProvider('selectedProvider');
const injectedProvider = React.useMemo(
() => injectedProviderQuery.data,
[injectedProviderQuery.data],
);
Returns
UseQueryResult
<{ details
: { iconType
: string
= ''; subtitleLabel
: string
= ''; titleLabel
: string
= '' } ; name
: INJECTED_PROVIDERS
= INJECTED_PROVIDERS.NOT_DETECTED }, Error
>
Defined in
ui/hooks/src/use-injected-provider.ts:54
useInstallApp
▸ useInstallApp(): UseMutationResult
<string
[], unknown
, { id?
: string
; name?
: string
}, unknown
>
Hook to persist an installed app config to a user's profile
example
useInstallApp hook
const installAppQuery = useInstallApp();
installAppQuery.mutate({ name: 'awesome integration', id: 'fhyuhjfhyrtl' });
Returns
UseMutationResult
<string
[], unknown
, { id?
: string
; name?
: string
}, unknown
>
Defined in
ui/hooks/src/use-app-settings.ts:76
useIsContactMultiple
▸ useIsContactMultiple(mainProfile
, checkIfContactsPubkeys
): UseQueryResult
<string
[], Error
>
Hook to check if a list of profiles are contacts for a specific user A contact relationship is defined by each of the two profiles following each other
example
useIsContactMultiple hook
const isContactMultipleQuery = useIsContactMultiple('user-pubkey', ['some-pubkey-1', 'some-pubkey-2']);
const contactList = isContactMultipleQuery.data;
Parameters
Name | Type |
---|---|
mainProfile | string |
checkIfContactsPubkeys | string [] |
Returns
UseQueryResult
<string
[], Error
>
Defined in
ui/hooks/src/use-follow.ts:181
useIsFollowingMultiple
▸ useIsFollowingMultiple(followerPubKey
, followingPubKeyArray
): UseQueryResult
<string
[], Error
>
Hook to check if a user is following other users
example
useIsFollowingMultiple hook
const isFollowingMultipleQuery = useIsFollowingMultiple('user-pubkey', ['some-pubkey-1', 'some-pubkey-2']);
const followedProfiles = isFollowingMultipleQuery.data;
Parameters
Name | Type |
---|---|
followerPubKey | string |
followingPubKeyArray | string [] |
Returns
UseQueryResult
<string
[], Error
>
Defined in
useIsSubscribedToTag
▸ useIsSubscribedToTag(tagName
, loggedEthAddress
): UseQueryResult
<boolean
, Error
>
Hook to check if a user is subscribed to a tag
example
useIsSubscribedToTag hook
const isSubscribedToTagQuery = useIsSubscribedToTag('awesome tag', 'logged-in-user-eth-address');
const isSubscribedToTag = isSubscribedToTagQuery.data;
Parameters
Name | Type |
---|---|
tagName | string |
loggedEthAddress | string |
Returns
UseQueryResult
<boolean
, Error
>
Defined in
useIsValidToken
▸ useIsValidToken(props
): UseQueryResult
<{ data
: boolean
}, Error
>
Hook to validate invitation token
example
useIsValidToken hook
const inviteTokenQuery = useIsValidToken({ inviteToken: '5b71c9dd7bdea84c9ff2564a', enabler: true });
const isValidToken = inviteTokenQuery.isSuccess;
Parameters
Name | Type |
---|---|
props | IUseIsValidTokenProps |
Returns
UseQueryResult
<{ data
: boolean
}, Error
>
Defined in
ui/hooks/src/use-invite-token-validation.ts:30
useLegalDoc
▸ useLegalDoc(docName
): UseQueryResult
<never
, Error
>
Hook to get legal docs stored on ipfs
example
useLegalDoc hook
const termsOfUseDocQuery = useLegalDoc('TermsOfUse');
const termsOfUseDoc = termsOfUseDocQuery.data;
Parameters
Name | Type |
---|---|
docName | LEGAL_DOCS |
Returns
UseQueryResult
<never
, Error
>
Defined in
useLogin
▸ useLogin(onError?
): UseMutationResult
<CurrentUser
& { isNewUser
: boolean
}, Error
, { checkRegistered
: boolean
; selectedProvider
: EthProviders
}, unknown
>
Hook to sign in a user
Parameters
Name | Type |
---|---|
onError? | (err : Error ) => void |
Returns
UseMutationResult
<CurrentUser
& { isNewUser
: boolean
}, Error
, { checkRegistered
: boolean
; selectedProvider
: EthProviders
}, unknown
>
Defined in
useLogout
▸ useLogout(): UseMutationResult
<true
, Error
, void
, unknown
>
Hook to sign out the current user
example
useLogout hook
const logoutMutation = useLogout();
// sample logout handler
const handleLogout = async () => {
await logoutMutation.mutateAsync();
// add other logic after logout
};
Returns
UseMutationResult
<true
, Error
, void
, unknown
>
Defined in
useMarkAsRead
▸ useMarkAsRead(): UseMutationResult
<{ data
: boolean
}, unknown
, string
, { previousCheckNotifs
: boolean
; previousNotifs
: IMessage
[] }>
Hook to mark a notification as read pass the messageId to the mutate function
example
useMarkAsRead hook
const markAsReadQuery = useMarkAsRead();
markAsReadQuery.mutate('message id');
Returns
UseMutationResult
<{ data
: boolean
}, unknown
, string
, { previousCheckNotifs
: boolean
; previousNotifs
: IMessage
[] }>
Defined in
ui/hooks/src/use-notifications.ts:75
useMentionSearch
▸ useMentionSearch(mention
): UseQueryResult
<(IProfileData
| { _id
: string
; avatar
: { fallbackUrl
: string
; url
: string
} ; coverImage
: { fallbackUrl
: string
; url
: string
} ; creationDate
: string
; default
: [DataProviderInput
] ; description
: string
; ethAddress
: string
; name
: string
; providers
: [DataProviderInput
] ; pubKey
: string
; totalFollowers
: number
; totalFollowing
: number
; totalInterests
: number
; totalPosts
: string
; userName
: string
})[], Error
>
Hook to search for profiles
example
useMentionSearch hook
const mentionQuery = useMentionSearch('awesomemention');
const mentions = mentionQuery.data;
Parameters
Name | Type |
---|---|
mention | string |
Returns
UseQueryResult
<(IProfileData
| { _id
: string
; avatar
: { fallbackUrl
: string
; url
: string
} ; coverImage
: { fallbackUrl
: string
; url
: string
} ; creationDate
: string
; default
: [DataProviderInput
] ; description
: string
; ethAddress
: string
; name
: string
; providers
: [DataProviderInput
] ; pubKey
: string
; totalFollowers
: number
; totalFollowing
: number
; totalInterests
: number
; totalPosts
: string
; userName
: string
})[], Error
>
Defined in
ui/hooks/src/use-mentions.ts:32
useModeration
▸ useModeration(): UseMutationResult
<number
, Error
, UseModerationParam
, unknown
>
Hook for creating a moderation decision
example
useModeration hook
const moderateMutation = useModeration();
moderateMutation.mutate({ dataToSign: { explanation: 'no violations detected', ... }, contentId: 'some-content-id', contentType: 'item type', url: 'https://apiendpoint', isPending: true });
Returns
UseMutationResult
<number
, Error
, UseModerationParam
, unknown
>
Defined in
ui/hooks/src/use-moderation.ts:78
useMutationListener
▸ useMutationListener<TVars
>(mutationKey
): Mutation
<unknown
, unknown
, TVars
, unknown
>
Hook to detect changes to a mutation
example
useMutationListener hook
const sampleMutation = useMutationListener('mutation key');
const variables = sampleMutation.state.variables;
Type parameters
Name |
---|
TVars |
Parameters
Name | Type |
---|---|
mutationKey | MutationKey |
Returns
Mutation
<unknown
, unknown
, TVars
, unknown
>
Mutation | undefined
Defined in
ui/hooks/src/use-query-listener.ts:21
useNetworkState
▸ useNetworkState(enabler?
): UseQueryResult
<{ networkNotSupported
: boolean
= true }, unknown
>
Hook to check if the web3 provider is set to function on the Rinkeby test network
example
useNetworkState hook
const networkStateQuery = useNetworkState(true);
const networkNotSupported = networkStateQuery.data.networkNotSupported;
Parameters
Name | Type |
---|---|
enabler? | boolean |
Returns
UseQueryResult
<{ networkNotSupported
: boolean
= true }, unknown
>
networkNotSupported: true if web3 provider is not on the specified network
Defined in
ui/hooks/src/use-network-state.ts:29
usePlaformHealthCheck
▸ usePlaformHealthCheck(): UseQueryResult
<{ statusCode
: number
= response.status; success
: boolean
= response.ok }, Error
>
Returns
UseQueryResult
<{ statusCode
: number
= response.status; success
: boolean
= response.ok }, Error
>
Defined in
ui/hooks/src/use-health-check.ts:13
usePost
▸ usePost(__namedParameters
): UseQueryResult
<{ _id
: string
; author
: { _id
: string
; avatar
: string
; contentId
: string
; coverImage
: string
; creationDate
: string
; default
: [DataProviderInput
] ; delisted
: boolean
; description
: string
; ethAddress
: string
; moderated
: boolean
; name
: string
; providers
: [DataProviderInput
] ; pubKey
: string
; reason
: string
; reported
: boolean
; totalFollowers
: number
; totalFollowing
: number
; totalInterests
: number
; totalPosts
: string
; userName
: string
} ; content
: [DataProviderInput
] ; contentId
: string
; creationDate
: string
; delisted
: boolean
; mentions
: [string
] ; moderated
: boolean
; quotedBy
: [string
] ; quotedByAuthors
: [UserProfile_Response
] ; quotes
: [Post_Response
] ; reason
: string
; reported
: boolean
; tags
: [string
] ; title
: string
; totalComments
: string
; type
: PostType
; updatedAt
: string
}, Error
>
Hook to get data for a specific post
example
usePost hook
const postQuery = usePost('some-post-id', 'logged-user-pubkey', true);
const entryData = React.useMemo(() => {
if (postQuery.data) {
// mapEntry is a utility function that transforms the comment/post data into required format.
return mapEntry(postQuery.data);
}
return undefined;
}, [postQuery.data]);
Parameters
Name | Type |
---|---|
__namedParameters | usePostParam |
Returns
UseQueryResult
<{ _id
: string
; author
: { _id
: string
; avatar
: string
; contentId
: string
; coverImage
: string
; creationDate
: string
; default
: [DataProviderInput
] ; delisted
: boolean
; description
: string
; ethAddress
: string
; moderated
: boolean
; name
: string
; providers
: [DataProviderInput
] ; pubKey
: string
; reason
: string
; reported
: boolean
; totalFollowers
: number
; totalFollowing
: number
; totalInterests
: number
; totalPosts
: string
; userName
: string
} ; content
: [DataProviderInput
] ; contentId
: string
; creationDate
: string
; delisted
: boolean
; mentions
: [string
] ; moderated
: boolean
; quotedBy
: [string
] ; quotedByAuthors
: [UserProfile_Response
] ; quotes
: [Post_Response
] ; reason
: string
; reported
: boolean
; tags
: [string
] ; title
: string
; totalComments
: string
; type
: PostType
; updatedAt
: string
}, Error
>
Defined in
usePosts
▸ usePosts(__namedParameters
): UseQueryResult
<{ _id
: string
; author
: { _id
: string
; avatar
: string
; contentId
: string
; coverImage
: string
; creationDate
: string
; default
: [DataProviderInput
] ; delisted
: boolean
; description
: string
; ethAddress
: string
; moderated
: boolean
; name
: string
; providers
: [DataProviderInput
] ; pubKey
: string
; reason
: string
; reported
: boolean
; totalFollowers
: number
; totalFollowing
: number
; totalInterests
: number
; totalPosts
: string
; userName
: string
} ; content
: [DataProviderInput
] ; contentId
: string
; creationDate
: string
; delisted
: boolean
; mentions
: [string
] ; moderated
: boolean
; quotedBy
: [string
] ; quotedByAuthors
: [UserProfile_Response
] ; quotes
: [Post_Response
] ; reason
: string
; reported
: boolean
; tags
: [string
] ; title
: string
; totalComments
: string
; type
: PostType
; updatedAt
: string
}, Error
>[]
Hook to get an array of post data
example
usePosts hook
const postQueries = usePost({ postIds: ['some-post-id', 'some-other-post-id'], loggedUser: 'logged-user-pubkey', enabler: true });
const entryData = postQueries.map(postQuery=>postQuery.data);
Parameters
Name | Type |
---|---|
__namedParameters | usePostsParam |
Returns
UseQueryResult
<{ _id
: string
; author
: { _id
: string
; avatar
: string
; contentId
: string
; coverImage
: string
; creationDate
: string
; default
: [DataProviderInput
] ; delisted
: boolean
; description
: string
; ethAddress
: string
; moderated
: boolean
; name
: string
; providers
: [DataProviderInput
] ; pubKey
: string
; reason
: string
; reported
: boolean
; totalFollowers
: number
; totalFollowing
: number
; totalInterests
: number
; totalPosts
: string
; userName
: string
} ; content
: [DataProviderInput
] ; contentId
: string
; creationDate
: string
; delisted
: boolean
; mentions
: [string
] ; moderated
: boolean
; quotedBy
: [string
] ; quotedByAuthors
: [UserProfile_Response
] ; quotes
: [Post_Response
] ; reason
: string
; reported
: boolean
; tags
: [string
] ; title
: string
; totalComments
: string
; type
: PostType
; updatedAt
: string
}, Error
>[]
Defined in
useQueryListener
▸ useQueryListener<TData
>(queryKey
): QueryObserverResult
<TData
, unknown
>
Hook to detect changes to a query
example
useQueryListener hook
const sampleQuery = useQueryListener('query key');
const result = sampleQuery.data;
Type parameters
Name |
---|
TData |
Parameters
Name | Type |
---|---|
queryKey | QueryKey |
Returns
QueryObserverResult
<TData
, unknown
>
Defined in
ui/hooks/src/use-query-listener.ts:47
useReasons
▸ useReasons(): [string
[], UseReasonsActions
]
A hook to get predefined reasons from moderation API
example
useReasons hook
const [reasons, reasonsActions] = useReasons();
// fetch reasons on mount
React.useEffect(() => {
reasonsActions.fetchReasons({ active: true });
}, []);
console.log(reasons);
Returns
[string
[], UseReasonsActions
]
Defined in
ui/hooks/src/use-reasons.ts:58
useReport
▸ useReport(): UseMutationResult
<number
, Error
, UseModerationParam
, unknown
>
Hook for reporting a post, reply or account
example
useReport hook
const reportMutation = useReport();
reportMutation.mutate({ dataToSign: { explanation: 'no violations detected', ... }, contentId: 'some-content-id', contentType: 'item type', url: 'https://apiendpoint' });
Returns
UseMutationResult
<number
, Error
, UseModerationParam
, unknown
>
Defined in
ui/hooks/src/use-moderation.ts:141
useRequiredNetworkName
▸ useRequiredNetworkName(): UseQueryResult
<string
, unknown
>
A hook to get required network name from the SDK
example
useRequiredNetworkName hook
const requiredNetworkQuery = useRequiredNetworkName();
const requiredNetworkName = requiredNetworkQuery.data;
Returns
UseQueryResult
<string
, unknown
>
Defined in
ui/hooks/src/use-injected-provider.ts:95
useSaveBookmark
▸ useSaveBookmark(): UseMutationResult
<string
[], unknown
, { entryId
: string
; itemType
: EntityTypes
}, { prevBmks
: { entryId
: string
; type
: EntityTypes
}[] }>
Hook used to bookmark resources. Pass as payload, entryData containing the resource id and itemType to the mutate function.
example
useSaveBookmark hook
const saveBookmarkQuery = useSaveBookmark();
saveBookmarkQuery.mutate({entryId: 'dbkjjouyahljfe', itemType: 'item type'});
Returns
UseMutationResult
<string
[], unknown
, { entryId
: string
; itemType
: EntityTypes
}, { prevBmks
: { entryId
: string
; type
: EntityTypes
}[] }>
Defined in
ui/hooks/src/use-bookmarks.ts:60
useSearch
▸ useSearch(searchQuery
, loggedUser?
, enabler?
): UseQueryResult
<{ comments
: IEntryData
[] ; entries
: IEntryData
[] ; profiles
: any
[] ; tags
: [] | [GlobalSearchResultTagItem
] }, Error
>
Hook for fetching search results for a specific query
example
useSearch hook
const searchQuery = useSearch('search keyword', 'logged-in-user-pubkey');
const result = searchQuery.data;
Parameters
Name | Type | Default value |
---|---|---|
searchQuery | string | undefined |
loggedUser? | string | undefined |
enabler | boolean | true |
Returns
UseQueryResult
<{ comments
: IEntryData
[] ; entries
: IEntryData
[] ; profiles
: any
[] ; tags
: [] | [GlobalSearchResultTagItem
] }, Error
>
search results for posts, comments, tags and profiles
Defined in
ui/hooks/src/use-search.ts:332
useSearchComments
▸ useSearchComments(searchQuery
, page
, loggedUser?
, enabler?
, pageSize?
): UseQueryResult
<IEntryData
[], Error
>
Hook to search for comments
example
useSearchComments hook
const searchCommentsQuery = useSearchComments('search keyword', 1, 'logged-in-user-pubkey');
const result = searchCommentsQuery.data;
Parameters
Name | Type | Default value |
---|---|---|
searchQuery | string | undefined |
page | number | undefined |
loggedUser? | string | undefined |
enabler | boolean | true |
pageSize | number | 5 |
Returns
UseQueryResult
<IEntryData
[], Error
>
search results for comments
Defined in
ui/hooks/src/use-search.ts:187
useSearchPosts
▸ useSearchPosts(searchQuery
, page
, loggedUser?
, enabler?
, pageSize?
): UseQueryResult
<IEntryData
[], Error
>
Hook to search for posts
example
useSearchPosts hook
const searchPostsQuery = useSearchPosts('search keyword', 1, 'logged-in-user-pubkey');
const result = searchPostsQuery.data;
Parameters
Name | Type | Default value |
---|---|---|
searchQuery | string | undefined |
page | number | undefined |
loggedUser? | string | undefined |
enabler | boolean | true |
pageSize | number | 5 |
Returns
UseQueryResult
<IEntryData
[], Error
>
search results for posts
Defined in
ui/hooks/src/use-search.ts:122
useSearchProfiles
▸ useSearchProfiles(searchQuery
, page
, loggedUser?
, enabler?
, pageSize?
): UseQueryResult
<any
[], Error
>
Hook to search for profiles
example
useSearchProfiles hook
const searchProfilesQuery = useSearchProfiles('search keyword', 1, 'logged-in-user-pubkey');
const result = searchProfilesQuery.data;
Parameters
Name | Type | Default value |
---|---|---|
searchQuery | string | undefined |
page | number | undefined |
loggedUser? | string | undefined |
enabler | boolean | true |
pageSize | number | 5 |
Returns
UseQueryResult
<any
[], Error
>
search results for profiles, containing full profile data
Defined in
useSearchTags
▸ useSearchTags(searchQuery
, enabler?
): UseQueryResult
<SearchTagsResult_Response
[], Error
>
Hook to search for tags
example
useSearchTags hook
const searchTagsQuery = useSearchTags('search keyword');
const result = searchTagsQuery.data;
Parameters
Name | Type | Default value |
---|---|---|
searchQuery | string | undefined |
enabler | boolean | true |
Returns
UseQueryResult
<SearchTagsResult_Response
[], Error
>
search results for posts, comments, tags and profiles
Defined in
ui/hooks/src/use-search.ts:225
useSignUp
▸ useSignUp(provider
, checkRegistered?
, analyticsActions?
): Object
Hook to sign up a user
example
useSignUp hook
const { signUpState, ethAddress, fireRemainingMessages, error, fullSignUp, resetState } = useSignUp('selected provider', true);
Parameters
Name | Type | Default value |
---|---|---|
provider | EthProviders | undefined |
checkRegistered | boolean | false |
analyticsActions? | UseAnalyticsActions | undefined |
Returns
Object
Name | Type |
---|---|
connectWallet | UseMutationResult <{ data : string }, WalletTransactionError , void , unknown > |
error | ErrorTypes |
ethAddress | string |
fireRemainingMessages | () => Promise <void > |
fullSignUp | UseMutationResult <{ data : CurrentUser & { isNewUser : boolean } }, WalletTransactionError , void , unknown > |
resetState | () => void |
signUpState | number |
Defined in
useTagSearch
▸ useTagSearch(tagName
): UseQueryResult
<SearchTagsResult_Response
[], Error
>
Hook to search for tags
example
useTagSearch hook
const tagSearchQuery = useTagSearch('awesometag');
const result = tagSearchQuery.data
Parameters
Name | Type |
---|---|
tagName | string |
Returns
UseQueryResult
<SearchTagsResult_Response
[], Error
>
Defined in
useTagSubscriptions
▸ useTagSubscriptions(loggedEthAddress
): UseQueryResult
<string
[], Error
>
Hook to get a user's subscribed tags
example
useTagSubscriptions hook
const subscribedTagsQuery = useTagSubscriptions('logged-in-user-eth-address');
const subscribedTags = subscribedTagsQuery.data;
Parameters
Name | Type |
---|---|
loggedEthAddress | string |
Returns
UseQueryResult
<string
[], Error
>
Defined in
useToggleTagSubscription
▸ useToggleTagSubscription(): UseMutationResult
<{ data
: { toggleInterestSub
: boolean
} }, unknown
, string
, { previousTagSubs
: string
[] }>
Hook to toggle a user's tag subscription. Pass the tagName to the mutate function
example
useToggleTagSubscription hook
const toggleTagSubscriptionQuery = useToggleTagSubscription();
toggleTagSubscriptionQuery.mutate('awesome tag');
Returns
UseMutationResult
<{ data
: { toggleInterestSub
: boolean
} }, unknown
, string
, { previousTagSubs
: string
[] }>
Defined in
useTrendingProfiles
▸ useTrendingProfiles(): UseQueryResult
<(IProfileData
| { _id
: string
; avatar
: { fallbackUrl
: string
; url
: string
} ; coverImage
: { fallbackUrl
: string
; url
: string
} ; creationDate
: string
; default
: [DataProviderInput
] ; description
: string
; ethAddress
: string
; name
: string
; providers
: [DataProviderInput
] ; pubKey
: string
; totalFollowers
: number
; totalFollowing
: number
; totalInterests
: number
; totalPosts
: string
; userName
: string
})[], Error
>
Hook to fetch trending profiles
example
useTrendingProfiles hook
const trendingProfilesQuery = useTrendingProfiles();
const trendingProfiles = trendingProfilesQuery.data;
Returns
UseQueryResult
<(IProfileData
| { _id
: string
; avatar
: { fallbackUrl
: string
; url
: string
} ; coverImage
: { fallbackUrl
: string
; url
: string
} ; creationDate
: string
; default
: [DataProviderInput
] ; description
: string
; ethAddress
: string
; name
: string
; providers
: [DataProviderInput
] ; pubKey
: string
; totalFollowers
: number
; totalFollowing
: number
; totalInterests
: number
; totalPosts
: string
; userName
: string
})[], Error
>
Defined in
ui/hooks/src/use-trending.ts:57
useTrendingTags
▸ useTrendingTags(): UseQueryResult
<SearchTagsResult_Response
[], Error
>
Hook to fetch trending tags
example
useTrendingTags hook
const trendingTagsQuery = useTrendingTags();
const trendingTags = trendingTagsQuery.data;
Returns
UseQueryResult
<SearchTagsResult_Response
[], Error
>
Defined in
ui/hooks/src/use-trending.ts:27
useUninstallApp
▸ useUninstallApp(): UseMutationResult
<void
, unknown
, string
, unknown
>
Hook to uninstall an app
example
useUninstallApp hook
const uninstallAppQuery = useUninstallApp();
uninstallAppQuery.mutate('awesome integration');
Returns
UseMutationResult
<void
, unknown
, string
, unknown
>
Defined in
ui/hooks/src/use-app-settings.ts:107
useUpdateUsernameProvider
▸ useUpdateUsernameProvider(pubKey?
): UseMutationResult
<void
| { makeDefaultProvider
: string
}, Error
, { provider
: ProfileProviders
; userName
: string
}, { currentProfile
: IProfileData
}>
Hook to register a username for the user. Pass as payload, the username and provider details to the mutate function
example
useUpdateUsernameProvider hook
const updateUsernameProviderQuery = useUpdateUsernameProvider('logged-in-user-pubkey');
// do something with the returned status of the query
React.useEffect(()=> {
if (updateUsernameProviderQuery.status === 'success') {
// perform an action
}
}, [updateUsernameProviderQuery])
Parameters
Name | Type |
---|---|
pubKey? | string |
Returns
UseMutationResult
<void
| { makeDefaultProvider
: string
}, Error
, { provider
: ProfileProviders
; userName
: string
}, { currentProfile
: IProfileData
}>
Defined in
ui/hooks/src/use-username.ts:77
useUsernameValidation
▸ useUsernameValidation(username
, enabler?
): UseQueryResult
<any
, unknown
>
Hook to check if a username is available
example
useUsernameValidation hook
const usernameValidationQuery = useUsernameValidation('awesomeusername', true);
// do something with the returned status of the query
const querySuccess = usernameValidationQuery.isSuccess
Parameters
Name | Type | Default value |
---|---|---|
username | string | undefined |
enabler | boolean | true |
Returns
UseQueryResult
<any
, unknown
>
Defined in
ui/hooks/src/use-username.ts:225
validateType
▸ validateType<T
>(arg1
, type
): boolean
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
arg1 | T |
type | string |
Returns
boolean
Defined in
ui/hooks/src/utils/generic-utils.ts:1
withProviders
▸ withProviders<T
>(WrappedComponent
): (props
: any
) => Element
Higher order component that wraps a component with all necessary providers
Type parameters
Name |
---|
T |
Parameters
Name | Type |
---|---|
WrappedComponent | ComponentType <T > |
Returns
fn
▸ (props
): Element
Parameters
Name | Type |
---|---|
props | any |
Returns
Element
Name | Type |
---|---|
displayName | string |