refactor: more TS code
This commit is contained in:
@@ -82,7 +82,7 @@ export const authApi = createApi({
|
||||
}
|
||||
}),
|
||||
// 更新 device token
|
||||
updateDeviceToken: builder.mutation<void, { device_token: string }>({
|
||||
updateDeviceToken: builder.mutation<void, string>({
|
||||
query: (device_token) => ({
|
||||
url: "/token/device_token",
|
||||
method: "PUT",
|
||||
|
||||
@@ -19,7 +19,7 @@ const favoritesSlice = createSlice({
|
||||
addFavorite(state, action: PayloadAction<Favorite>) {
|
||||
state.push(action.payload);
|
||||
},
|
||||
deleteFavorite(state, action: PayloadAction<number>) {
|
||||
deleteFavorite(state, action: PayloadAction<string>) {
|
||||
const id = action.payload;
|
||||
const idx = state.findIndex((f) => f.id == id);
|
||||
if (idx > -1) {
|
||||
|
||||
@@ -1,13 +1,6 @@
|
||||
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
|
||||
import BASE_URL, { ContentTypes } from "../config";
|
||||
import { isImage } from "../../common/utils";
|
||||
|
||||
export interface State {
|
||||
[key: number]: object;
|
||||
replying: {
|
||||
[key: string | number]: number;
|
||||
};
|
||||
}
|
||||
export interface MessagePayload {
|
||||
mid: number;
|
||||
sending: boolean;
|
||||
@@ -21,6 +14,13 @@ export interface MessagePayload {
|
||||
download?: string;
|
||||
thumbnail?: string;
|
||||
}
|
||||
export interface State {
|
||||
[key: number]: MessagePayload;
|
||||
replying: {
|
||||
[key: string | number]: number;
|
||||
};
|
||||
}
|
||||
|
||||
const initialState: State = {
|
||||
replying: {}
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user