import type {BaseQueryFn} from '@reduxjs/toolkit/query'; import {createApi} from '@reduxjs/toolkit/query/react'; import {CLUSTER_DATA_TAG, DATABASE_DATA_TAG} from './entityDataTags'; export const api = createApi({ baseQuery: fakeBaseQuery(), /** * This api has endpoints injected in adjacent files, * which is why no endpoints are shown below. */ endpoints: () => ({}), invalidationBehavior: 'immediately', tagTypes: [ 'All', 'Conversations', 'Events', 'PDiskData', 'PreviewData', 'SchemaTree', 'StorageData', 'TableData', 'Partitions', 'Tablet', 'UserData', 'VDiskData', 'VDiskBlobIndexStat', 'AccessRights', 'Backups', 'BackupsSchedule', 'OperationList', DATABASE_DATA_TAG, CLUSTER_DATA_TAG, ], }); export const _NEVER = Symbol(); type NEVER = typeof _NEVER; /** * Creates a "fake" baseQuery to be used if your api *only* uses the `queryFn` definition syntax. * This also allows you to specify a specific error type to be shared by all your `queryFn` definitions. * * Can't use fakeBaseQuery from @reduxjs/toolkit/query, because of error */ function fakeBaseQuery(): BaseQueryFn { return function () { throw new Error( 'When using `fakeBaseQuery`, all queries & mutations must use the `queryFn` definition syntax.', ); }; }