feat: upload files and management

This commit is contained in:
zerosoul
2022-03-30 10:17:48 +08:00
parent 40492c5e72
commit bdc4ab2db1
32 changed files with 585 additions and 121 deletions
+4
View File
@@ -22,6 +22,10 @@ const tables = [
storeName: "message",
description: "store message with key-val full data",
},
{
storeName: "messageFile",
description: "store file message list refs",
},
{
storeName: "messageReaction",
description: "store message reaction with key-val full data",
+7
View File
@@ -9,6 +9,7 @@ import { fullfillUserMsg } from "../slices/message.user";
import { fullfillChannels } from "../slices/channels";
import { fullfillContacts } from "../slices/contacts";
import { fullfillFootprint } from "../slices/footprint";
import { fullfillFileMessage } from "../slices/message.file";
import { fullfillUI } from "../slices/ui";
const useRehydrate = () => {
const [iterated, setIterated] = useState(false);
@@ -17,6 +18,7 @@ const useRehydrate = () => {
const rehydrateData = {
channels: [],
contacts: [],
fileMessage: {},
channelMessage: {},
userMessage: {},
reactionMessage: {},
@@ -50,6 +52,9 @@ const useRehydrate = () => {
case "messageChannel":
rehydrateData.channelMessage[key] = data;
break;
case "messageFile":
rehydrateData.fileMessage[key] = data || [];
break;
case "messageDM":
rehydrateData.userMessage[key] = data;
break;
@@ -74,6 +79,8 @@ const useRehydrate = () => {
dispatch(fullfillServer(rehydrateData.server));
console.log("fullfill channels from indexedDB");
dispatch(fullfillChannels(rehydrateData.channels));
// file message
dispatch(fullfillFileMessage(rehydrateData.fileMessage.list));
dispatch(fullfillChannelMsg(rehydrateData.channelMessage));
dispatch(fullfillUserMsg(rehydrateData.userMessage));
dispatch(fullfillMessage(rehydrateData.message));