2017-10-24 21:01:58 +08:00
|
|
|
/* eslint no-unused-vars: 0 */
|
2016-05-04 04:40:46 +08:00
|
|
|
import React from 'react';
|
2016-04-29 03:02:51 +08:00
|
|
|
import { Meteor } from 'meteor/meteor';
|
2018-10-25 23:51:53 +08:00
|
|
|
import { Session } from 'meteor/session';
|
2016-04-29 03:02:51 +08:00
|
|
|
import { render } from 'react-dom';
|
2018-06-20 00:46:59 +08:00
|
|
|
import logger from '/imports/startup/client/logger';
|
2018-10-03 03:53:13 +08:00
|
|
|
import { joinRouteHandler, authenticatedRouteHandler } from '/imports/startup/client/auth';
|
2018-09-21 23:43:10 +08:00
|
|
|
import Base from '/imports/startup/client/base';
|
2018-10-25 23:51:53 +08:00
|
|
|
import LoadingScreen from '/imports/ui/components/loading-screen/component';
|
2016-05-12 04:43:07 +08:00
|
|
|
|
2016-01-13 04:15:16 +08:00
|
|
|
Meteor.startup(() => {
|
2018-09-21 23:43:10 +08:00
|
|
|
render(<LoadingScreen />, document.getElementById('app'));
|
|
|
|
|
2018-06-20 00:46:59 +08:00
|
|
|
// Logs all uncaught exceptions to the client logger
|
2017-10-24 20:59:23 +08:00
|
|
|
window.addEventListener('error', (e) => {
|
2018-10-03 03:53:13 +08:00
|
|
|
const { stack } = e.error;
|
2018-06-20 00:46:59 +08:00
|
|
|
let message = e.error.toString();
|
|
|
|
|
|
|
|
// Checks if stack includes the message, if not add the two together.
|
2018-10-25 23:51:53 +08:00
|
|
|
if (stack.includes(message)) {
|
|
|
|
message = stack;
|
|
|
|
} else {
|
|
|
|
message += `\n${stack}`;
|
|
|
|
}
|
2018-06-20 00:46:59 +08:00
|
|
|
logger.error(message);
|
2017-10-24 20:59:23 +08:00
|
|
|
});
|
2018-09-21 23:43:10 +08:00
|
|
|
|
|
|
|
// TODO make this a Promise
|
2018-10-03 03:53:13 +08:00
|
|
|
joinRouteHandler((value, error) => {
|
2018-10-25 23:51:53 +08:00
|
|
|
if (error) {
|
|
|
|
logger.error(`User faced [${value}] on main.joinRouteHandler. Error was:`, JSON.stringify(error));
|
|
|
|
} else {
|
|
|
|
logger.info(`User successfully went through main.joinRouteHandler with [${value}].`);
|
|
|
|
}
|
|
|
|
authenticatedRouteHandler(() => {
|
2018-10-06 03:23:16 +08:00
|
|
|
// set defaults
|
2018-10-12 04:41:37 +08:00
|
|
|
Session.set('isChatOpen', false);
|
|
|
|
Session.set('idChatOpen', '');
|
2018-10-13 01:05:30 +08:00
|
|
|
Session.set('isMeetingEnded', false);
|
2018-10-03 03:53:13 +08:00
|
|
|
render(<Base />, document.getElementById('app'));
|
|
|
|
});
|
2018-09-21 23:43:10 +08:00
|
|
|
});
|
2016-01-13 04:15:16 +08:00
|
|
|
});
|