feat: markdown auto format

This commit is contained in:
zerosoul
2022-03-25 09:40:40 +08:00
parent a9e06dcc7d
commit bdaf27f224
37 changed files with 1750 additions and 1032 deletions
+2 -2
View File
@@ -10,14 +10,14 @@ const whiteList = [
"getServer",
"getOpenid",
"getMetamaskNonce",
"renew",
];
const baseQuery = fetchBaseQuery({
baseUrl: BASE_URL,
prepareHeaders: (headers, { getState, endpoint }) => {
console.log("req", endpoint);
const { token } = getState().authData;
const noHeaderList = [...whiteList, "renew"];
if (token && !noHeaderList.includes(endpoint)) {
if (token && !whiteList.includes(endpoint)) {
headers.set(tokenHeader, token);
}
return headers;
+15 -1
View File
@@ -1,7 +1,7 @@
import { createApi } from "@reduxjs/toolkit/query/react";
// import { batch } from "react-redux";
import { ContentTypes } from "../config";
import BASE_URL, { ContentTypes } from "../config";
import { updateReadChannels, updateReadUsers } from "../slices/footprint";
import { onMessageSendStarted } from "./handlers";
@@ -38,6 +38,19 @@ export const messageApi = createApi({
method: "DELETE",
}),
}),
uploadImage: builder.mutation({
query: (image) => ({
headers: {
"content-type": ContentTypes.image,
},
url: `/resource/image`,
method: "POST",
body: image,
}),
transformResponse: (image_id) => {
return `${BASE_URL}/resource/image?id=${encodeURIComponent(image_id)}`;
},
}),
replyMessage: builder.mutation({
query: ({ reply_mid, content, type = "text" }) => ({
headers: {
@@ -89,6 +102,7 @@ export const messageApi = createApi({
});
export const {
useUploadImageMutation,
useEditMessageMutation,
useReactMessageMutation,
useReplyMessageMutation,