feat: chat layout setting

This commit is contained in:
Tristan Yang
2023-05-15 13:17:18 +08:00
parent 27204a1c11
commit a71a00d493
5 changed files with 75 additions and 15 deletions
+7
View File
@@ -170,6 +170,13 @@ export const serverApi = createApi({
}),
getSystemCommon: builder.query<SystemCommon, void>({
query: () => ({ url: `/admin/system/common` }),
transformResponse: (resp: SystemCommon) => {
let tmp = resp;
tmp.chat_layout_mode = resp.chat_layout_mode ?? "Left";
tmp.contact_verification_enable = resp.contact_verification_enable ?? false;
tmp.max_file_expiry_mode = resp.max_file_expiry_mode ?? "Off";
return tmp;
},
async onQueryStarted(data, { dispatch, queryFulfilled }) {
try {
const resp = await queryFulfilled;
+5 -1
View File
@@ -22,6 +22,8 @@ const initialState: StoredServer = {
},
show_user_online_status: false,
webclient_auto_update: true,
contact_verification_enable: false,
chat_layout_mode: "Left"
};
const serverSlice = createSlice({
@@ -44,8 +46,10 @@ const serverSlice = createSlice({
description = "",
show_user_online_status = true,
webclient_auto_update = true,
contact_verification_enable = false,
chat_layout_mode = "Left"
} = action.payload || {};
return { version, upgraded, name, logo, description, inviteLink, show_user_online_status, webclient_auto_update };
return { version, upgraded, name, logo, description, inviteLink, show_user_online_status, webclient_auto_update, contact_verification_enable, chat_layout_mode };
},
updateInfo(state, action: PayloadAction<Partial<StoredServer>>) {
const values = action.payload || {};