refactor: more TS code

This commit is contained in:
Tristan Yang
2022-07-29 22:59:22 +08:00
parent 6bb7af46a0
commit 33c24baecb
52 changed files with 232 additions and 273 deletions
+4 -4
View File
@@ -126,13 +126,13 @@ export const authApi = createApi({
}),
sendRegMagicLink: builder.mutation<
{
new_magic_token: "string";
new_magic_token: string;
mail_is_sent: boolean;
},
{
magic_token: "string";
email: "string";
password: "string";
magic_token: string;
email: string;
password: string;
}
>({
query: (data) => ({
+1 -1
View File
@@ -121,7 +121,7 @@ export const serverApi = createApi({
getLoginConfig: builder.query<LoginConfig, void>({
query: () => ({ url: `admin/login/config` })
}),
updateLoginConfig: builder.mutation<void, LoginConfig>({
updateLoginConfig: builder.mutation<void, Partial<LoginConfig>>({
query: (data) => ({
url: `admin/login/config`,
method: "POST",
+8 -1
View File
@@ -1,11 +1,16 @@
import { createSlice, PayloadAction } from "@reduxjs/toolkit";
import BASE_URL, { ContentTypes } from "../config";
import { isImage } from "../../common/utils";
import { ContentType } from "../../types/message";
export interface MessagePayload {
mid: number;
from_uid?: number;
read?: boolean;
created_at?: number;
sending: boolean;
content_type: string;
content_type: ContentType;
content: string;
expires_in?: number | null;
properties?: {
content_type: string;
size: number;
@@ -13,6 +18,8 @@ export interface MessagePayload {
file_path?: string;
download?: string;
thumbnail?: string;
edited?: boolean | number;
reply_mid?: number;
}
export interface State {
[key: number]: MessagePayload;
+8 -1
View File
@@ -8,7 +8,14 @@ export interface State {
menuExpand: boolean;
// todo
fileListView: string;
uploadFiles: { [key: string]: any };
uploadFiles: {
[key: string]: {
name: string;
url: string;
size: number;
type: string;
}[];
};
selectMessages: { [key: string]: any };
draftMarkdown: { [key: string]: any };
draftMixedText: { [key: string]: any };