Skip to content

Commit

Permalink
fix: added all tags to tagTypes
Browse files Browse the repository at this point in the history
  • Loading branch information
wwills2 committed Feb 28, 2024
1 parent 0e8a7bf commit 536d7d5
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 17 deletions.
23 changes: 12 additions & 11 deletions src/renderer/api/ipc/datalayer/datalayer.api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import { ipcApi } from '..';
import {
ipcApi,
datalayerConfigTag,
mirrorsTag,
subscriptionsTag,
dataStoresTag
} from '@/api';

/**
* importing the chia-datalayer module and its typescript types
Expand Down Expand Up @@ -27,11 +33,6 @@ import {
// @ts-ignore
import {BaseQueryResult} from "@reduxjs/toolkit/dist/query/baseQueryTypes";

const configTag: string = 'datalayerConfig';
const mirrorsTag: string = 'mirrors';
const dataStoresTag: string = 'dataStores';
const subscriptionsTag: string = 'subscriptions';

/**
* RTKquery state managment API for chia-wallet
*/
Expand All @@ -40,13 +41,13 @@ const datalayerApi = ipcApi.injectEndpoints({
getConfig: builder.query<any, any>({
query: () => ({ channel: 'datalayerGetConfig', args: {} }),
// @ts-ignore
providesTags: () => [configTag],
providesTags: () => [datalayerConfigTag],
}),

setConfig: builder.mutation<any, DatalayerConfig>({
query: (args) => ({ channel: 'datalayerSetConfig', args }),
//@ts-ignore
invalidatesTags: () => [configTag],
invalidatesTags: () => [datalayerConfigTag],
}),

addMirror: builder.mutation<any, AddMirrorParams>({
Expand All @@ -62,13 +63,13 @@ const datalayerApi = ipcApi.injectEndpoints({
createDataStore: builder.mutation<any, CreateDataStoreParams>({
query: (args) => ({ channel: 'datalayerCreateDataStore', args }),
//@ts-ignore
invalidatesTags: () => [{ type: 'datalayerStore' }],
invalidatesTags: () => [{ type: dataStoresTag }],
}),

deleteMirror: builder.mutation<any, DeleteMirrorParams>({
query: (args) => ({ channel: 'datalayerDeleteMirror', args }),
//@ts-ignore
invalidatesTags: () => [dataStoresTag],
invalidatesTags: () => [mirrorsTag],
}),

getKeys: builder.query<any, GetKeysParams>({
Expand All @@ -92,7 +93,7 @@ const datalayerApi = ipcApi.injectEndpoints({
getOwnedStores: builder.query<any, any>({
query: () => ({ channel: 'datalayerGetOwnedStores', args: {} }),
// @ts-ignore
providesTags: () => [{ type: 'datalayerStore', id: 'LIST' }],
providesTags: () => [{ type: dataStoresTag, id: 'LIST' }],
}),

getRoot: builder.query<any, GetRootParams>({
Expand Down
10 changes: 9 additions & 1 deletion src/renderer/api/ipc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ import { createApi } from '@reduxjs/toolkit/query/react';
const electron = window.require("electron");
const ipcRenderer = electron.ipcRenderer;

const walletConfigTag: string = "walletConfig";
const datalayerConfigTag: string = 'datalayerConfig';
const mirrorsTag: string = 'mirrors';
const dataStoresTag: string = 'dataStores';
const subscriptionsTag: string = 'subscriptions';

interface ipcRendererBaseQueryArgs {
channel: string;
args: any;
Expand Down Expand Up @@ -31,9 +37,11 @@ const ipcRendererBaseQuery = async ({
}
};

export { datalayerConfigTag, mirrorsTag, subscriptionsTag, dataStoresTag, walletConfigTag }

export const ipcApi = createApi({
baseQuery: ipcRendererBaseQuery,
tagTypes: ['datalayerStore'],
tagTypes: [datalayerConfigTag, mirrorsTag, subscriptionsTag, dataStoresTag, walletConfigTag],
reducerPath: "ipcApi",
endpoints: () => ({}),
});
8 changes: 3 additions & 5 deletions src/renderer/api/ipc/wallet/wallet.api.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ipcApi } from "@/api";
import { ipcApi, walletConfigTag } from "@/api";

/**
* importing the chia-wallet module and its typescript types
Expand All @@ -12,8 +12,6 @@ import {
// @ts-ignore
} from 'chia-wallet';

const configTag: string = "walletConfig";

/**
* RTKquery state managment API for chia-wallet
*/
Expand All @@ -22,13 +20,13 @@ const walletApi = ipcApi.injectEndpoints({
getConfig: builder.query<WalletConfig, any>({
query: () => ({ channel: 'walletGetConfig', args: {} }),
// @ts-ignore
providesTags: () => [configTag],
providesTags: () => [walletConfigTag],
}),

setConfig: builder.mutation<WalletConfig, any>({
query: (args) => ({ channel: 'walletSetConfig', args }),
// @ts-ignore
invalidatesTags: () => [configTag],
invalidatesTags: () => [walletConfigTag],
}),

getLoggedInFingerprint: builder.query<any, any>({
Expand Down

0 comments on commit 536d7d5

Please sign in to comment.