This commit is contained in:
felinae98
2022-08-07 23:12:18 +08:00
parent b8af6d0024
commit ea928bf3fc
12 changed files with 149 additions and 27 deletions
@@ -0,0 +1,9 @@
import React from 'react';
import { useGetWeightQuery } from './weightConfigSlice';
export default function WeightManager() {
const { data: weight } = useGetWeightQuery();
return (
<div>{weight && JSON.stringify(weight)}</div>
);
}
@@ -0,0 +1,18 @@
import { createApi } from '@reduxjs/toolkit/query/react';
import baseQueryWithAuth from '../auth/authQuery';
export const weightApi = createApi({
reducerPath: 'weight',
baseQuery: baseQueryWithAuth,
tagTypes: ['Weight'],
endpoints: (builder) => ({
getWeight: builder.query<any, void>({
query: () => '/weight',
providesTags: ['Weight'],
}),
}),
});
export const {
useGetWeightQuery,
} = weightApi;