Initial work for file sharing using WebTorrent
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import
|
||||
{
|
||||
createNewMessage
|
||||
createNewMessage,
|
||||
createNewFile
|
||||
} from './helper';
|
||||
|
||||
const chatmessages = (state = [], action) =>
|
||||
@@ -11,7 +12,16 @@ const chatmessages = (state = [], action) =>
|
||||
{
|
||||
const { text } = action.payload;
|
||||
|
||||
const message = createNewMessage(text, 'client', 'Me');
|
||||
const message = createNewMessage(text, 'client', 'Me', undefined);
|
||||
|
||||
return [ ...state, message ];
|
||||
}
|
||||
|
||||
case 'ADD_NEW_USER_FILE':
|
||||
{
|
||||
const { file } = action.payload;
|
||||
|
||||
const message = createNewFile(file, 'client', 'Me', undefined);
|
||||
|
||||
return [ ...state, message ];
|
||||
}
|
||||
|
||||
@@ -8,4 +8,16 @@ export function createNewMessage(text, sender, name, picture)
|
||||
sender,
|
||||
picture
|
||||
};
|
||||
}
|
||||
|
||||
export function createNewFile(file, sender, name, picture)
|
||||
{
|
||||
return {
|
||||
type: 'file',
|
||||
file,
|
||||
time: Date.now(),
|
||||
name,
|
||||
sender,
|
||||
picture
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user