Merge remote-tracking branch 'upstream/main' into refactor/typescript

# Conflicts:
#	src/common/component/ForwardModal/index.tsx
#	src/common/component/GoogleLoginButton.tsx
#	src/common/component/ManageMembers.tsx
#	src/routes/settingChannel/Overview.tsx
#	src/routes/settingChannel/index.tsx
This commit is contained in:
HD
2022-06-29 17:04:22 +08:00
44 changed files with 207 additions and 292 deletions
+1 -2
View File
@@ -2,7 +2,7 @@ import { createApi } from "@reduxjs/toolkit/query/react";
// import toast from "react-hot-toast";
import { KEY_UID } from "../config";
import baseQuery from "./base.query";
import { resetAuthData, setUid } from "../slices/auth.data";
import { resetAuthData } from "../slices/auth.data";
import { updateMute } from "../slices/footprint";
import { fullfillContacts } from "../slices/contacts";
import BASE_URL, { ContentTypes } from "../config";
@@ -41,7 +41,6 @@ export const contactApi = createApi({
const markedContacts = contacts.map((u) => {
return u.uid == matchedUser.uid ? { ...u, online: true } : u;
});
dispatch(setUid(matchedUser.uid));
dispatch(fullfillContacts(markedContacts));
}
} catch {
+1 -1
View File
@@ -132,7 +132,7 @@ export const messageApi = createApi({
async onQueryStarted(id, { dispatch, queryFulfilled, getState }) {
try {
const { data } = await queryFulfilled;
const loginUid = getState().authData.uid;
const loginUid = getState().authData.user.uid;
const messages = normalizeArchiveData(data, id, loginUid);
dispatch(populateFavorite({ id, messages }));
} catch (err) {
+4 -7
View File
@@ -1,6 +1,6 @@
import { createApi } from "@reduxjs/toolkit/query/react";
import BASE_URL from "../config";
import { updateInfo, StoredServer } from "../slices/server";
import { updateInfo } from "../slices/server";
import baseQuery from "./base.query";
import { RootState } from "../store";
import { User } from "../../types/auth";
@@ -22,16 +22,13 @@ export const serverApi = createApi({
reducerPath: "serverApi",
baseQuery,
endpoints: (builder) => ({
getServer: builder.query<StoredServer, void>({
getServer: builder.query<Server, void>({
query: () => ({ url: `admin/system/organization` }),
transformResponse: (data: Server) => {
const logo = `${BASE_URL}/resource/organization/logo?t=${+new Date()}`;
return { ...data, logo };
},
async onQueryStarted(data, { dispatch, queryFulfilled }) {
try {
const { data: server } = await queryFulfilled;
dispatch(updateInfo(server));
const logo = `${BASE_URL}/resource/organization/logo?t=${+new Date()}`;
dispatch(updateInfo({ ...server, logo }));
} catch {
console.log("get server info error");
}