feat: remeber file list view
This commit is contained in:
+5
-2
@@ -1,6 +1,6 @@
|
||||
// const BASE_URL = `${location.origin}/api`;
|
||||
const BASE_URL = `https://dev.rustchat.com/api`;
|
||||
export const CACHE_VERSION = `0.2.1`;
|
||||
export const CACHE_VERSION = `0.3`;
|
||||
// const BASE_URL = `https://rustchat.net/api`;
|
||||
export const ContentTypes = {
|
||||
text: "text/plain",
|
||||
@@ -24,5 +24,8 @@ export const KEY_DEVICE_KEY = "RUSTCHAT_DEVICE_KEY";
|
||||
export const KEY_USERS_VERSION = "RUSTCHAT_USERS_VERSION";
|
||||
export const KEY_AFTER_MID = "RUSTCHAT_AFTER_MID";
|
||||
export const Emojis = ["👍", "❤️", "😄", "👀", "👎", "🎉", "🙁", "🚀"];
|
||||
|
||||
export const Views = {
|
||||
item: "item",
|
||||
grid: "grid",
|
||||
};
|
||||
export default BASE_URL;
|
||||
|
||||
@@ -17,6 +17,11 @@ export default async function handler({ operation, data = {} }) {
|
||||
await table.setItem("inputMode", data.inputMode);
|
||||
}
|
||||
break;
|
||||
case "updateFileListView":
|
||||
{
|
||||
await table.setItem("fileListView", data.fileListView);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
import { createSlice } from "@reduxjs/toolkit";
|
||||
|
||||
import { Views } from "../config";
|
||||
const initialState = {
|
||||
online: true,
|
||||
ready: false,
|
||||
@@ -7,6 +7,7 @@ const initialState = {
|
||||
menuExpand: false,
|
||||
setting: false,
|
||||
channelSetting: null,
|
||||
fileListView: Views.item,
|
||||
};
|
||||
const uiSlice = createSlice({
|
||||
name: "ui",
|
||||
@@ -27,6 +28,9 @@ const uiSlice = createSlice({
|
||||
updateInputMode(state, action) {
|
||||
state.inputMode = action.payload;
|
||||
},
|
||||
updateFileListView(state, action) {
|
||||
state.fileListView = action.payload;
|
||||
},
|
||||
toggleSetting(state) {
|
||||
state.setting = !state.setting;
|
||||
},
|
||||
@@ -45,5 +49,6 @@ export const {
|
||||
toggleSetting,
|
||||
toggleMenuExpand,
|
||||
toggleChannelSetting,
|
||||
updateFileListView,
|
||||
} = uiSlice.actions;
|
||||
export default uiSlice.reducer;
|
||||
|
||||
Reference in New Issue
Block a user