-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsound_byte.jsx
38 lines (37 loc) · 1.14 KB
/
sound_byte.jsx
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import React from 'react';
import ReactDOM from 'react-dom';
import Sound from 'react-sound';
import { signup, login, logout, receiveCurrentUser } from './actions/session_actions';
import configureStore from './store/store.js';
import Root from './components/root';
import { createTrack, fetchAllTracksForUser, fetchAllComments, allComments } from './actions/track_actions';
window.soundManager.setup({debugMode: false});
document.addEventListener('DOMContentLoaded', () => {
let store;
if (window.currentUser) {
const initialState = {
session: {
currentUser: window.currentUser
},
tracks: {
},
currentTrackView: {
track: null,
comments: null
},
audio: {
currentSong: null,
position: 0,
volume: 50,
playStatus: Sound.status.PLAYING,
}
};
store = configureStore(initialState);
store.dispatch(fetchAllTracksForUser());
} else {
store = configureStore();
}
window.store = store;
const root = document.getElementById('root');
ReactDOM.render(<Root store={store}/>, root);
});