mirror of
https://github.com/suyiiyii/nonebot-bison.git
synced 2026-05-09 18:27:56 +08:00
update
This commit is contained in:
@@ -2,12 +2,14 @@ import { configureStore, ThunkAction, Action } from '@reduxjs/toolkit';
|
||||
import authReducer from '../features/auth/authSlice';
|
||||
import globalConfReducer from '../features/globalConf/globalConfSlice';
|
||||
import { subscribeApi } from '../features/subsribeConfigManager/subscribeConfigSlice';
|
||||
import { weightApi } from '../features/weightConfig/weightConfigSlice';
|
||||
|
||||
export const store = configureStore({
|
||||
reducer: {
|
||||
auth: authReducer,
|
||||
globalConf: globalConfReducer,
|
||||
[subscribeApi.reducerPath]: subscribeApi.reducer,
|
||||
[weightApi.reducerPath]: weightApi.reducer,
|
||||
},
|
||||
middleware: (getDefaultMiddleware) => getDefaultMiddleware().concat(subscribeApi.middleware),
|
||||
});
|
||||
|
||||
@@ -1,18 +1,13 @@
|
||||
import React from 'react';
|
||||
import { useGetSubsQuery, useDeleteSubMutation } from './subscribeConfigSlice';
|
||||
import { useGetSubsQuery } from './subscribeConfigSlice';
|
||||
|
||||
export default function SubscribeManager() {
|
||||
const { data: subs } = useGetSubsQuery();
|
||||
const [patchSub] = useDeleteSubMutation();
|
||||
|
||||
const createNewSub = () => {
|
||||
patchSub({ target: '2773976700', platformName: 'weibo', groupNumber: 868610060 }).unwrap();
|
||||
};
|
||||
return (
|
||||
<>
|
||||
<div>{ subs && JSON.stringify(subs) }</div>
|
||||
<div>1</div>
|
||||
<button onClick={() => createNewSub()} type="button">new</button>
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
@@ -1,11 +1,12 @@
|
||||
import React from 'react';
|
||||
import SubscribeManager from '../features/subsribeConfigManager/SubscribeManager';
|
||||
// import SubscribeManager from '../features/subsribeConfigManager/SubscribeManager';
|
||||
import WeightManager from '../features/weightConfig/WeightManager';
|
||||
|
||||
export default function Home() {
|
||||
return (
|
||||
<>
|
||||
<div>hoem</div>
|
||||
<SubscribeManager />
|
||||
<WeightManager />
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
@@ -52,3 +52,9 @@ export interface SubmitParam {
|
||||
groupNumber: number;
|
||||
sub: SubscribeConfig;
|
||||
}
|
||||
|
||||
export interface TimeWeightConfig {
|
||||
start_time: string;
|
||||
end_time: string;
|
||||
weight: number;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user