Skip to main content

Accounts

A shared package that exports queries, mutations, types, and utility functions for accounts.

Usage​

The module has been imported into our root npm package. All you have to do is import it into your module.

import { Account } from '@shared/accounts'

Exported Queries​

useAccountsPaginatedQuery​

Fetches a paginated list of accounts from the public-api accounts endpoint. You are able to pass an optional set of query params and optionally override the underlying UseQueryOptions.

const { data, isLoading } = useAccountsPaginatedQuery(queryParams)

getAccounts​

Fetches a paginated list of accounts from the public-api accounts endpoint. You are able to pass an optional set of query params and optionally override the underlying UseQueryOptions.

This is only to be used outside of React. If you are in React please use the hook.

const { data } = getAccounts(queryParams)

Exported Types​

TypeDescription
AccountAccount resource returned by our public apis

Private api Usage​

import { privateAccountApi } from '@shared/accounts'

Exported Private Queries​

useAccountQuery​

Fetches an account from the private-api accounts endpoint. You are able to pass an optional set of query params and optionally override the underlying UseQueryOptions.

const { data, isLoading } = useAccountQuery(id, AccountQueryOptions)

invalidateAccountQuery​

Function to invalidate the account query

import { privateAccountApi } from '@shared/accounts'

privateAccountApi.queries.invalidateAccountQuery()

setAccountQueryData​

Function to set the account query

import { privateAccountApi } from '@shared/accounts'

privateAccountApi.queries.setAccountQueryData(account.id, AccountTypeData)

Exported Private Mutations​

updateAccountMutation​

Function to update the account. You are able to pass an optional set of query params and optionally override the underlying UseQueryOptions.

import { privateAccountApi } from '@shared/accounts'

privateAccountApi.mutations.updateAccountMutation(AccountQueryOptions)

Exported Private Mocks​

Private account mocks

import { privateAccountApi } from '@shared/accounts'

privateAccountApi.mocks.melodyAccountMock

Exported Private Types​

import { PrivateApiAccountType } from '@shared/accounts'
TypeDescription
AccountAccount resource returned by our private api
AccountFieldsAccount fields type