AdminSocketIoContainer.js 581 B

12345678910111213141516171819202122232425
  1. import SocketIoContainer from './SocketIoContainer';
  2. import { toastError } from '../util/apiNotification';
  3. /**
  4. * A subclass of SocketIoContainer for /admin namespace
  5. */
  6. export default class AdminSocketIoContainer extends SocketIoContainer {
  7. constructor(appContainer) {
  8. super(appContainer, '/admin');
  9. // show toastr
  10. this.socket.on('error', (error) => {
  11. toastError(new Error(error));
  12. });
  13. }
  14. /**
  15. * Workaround for the mangling in production build to break constructor.name
  16. */
  17. static getClassName() {
  18. return 'AdminSocketIoContainer';
  19. }
  20. }