Skip to content

Commit

Permalink
Logout user when running in background (#443)
Browse files Browse the repository at this point in the history
  • Loading branch information
Ilya Vilensky authored Mar 19, 2020
1 parent 830198b commit fdc25d6
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/components/common/OnQuitModal.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,12 @@
import React, { Component } from 'react';
import { ipcRenderer } from 'electron';
import { connect } from 'react-redux';
import { logout } from '/redux/auth/actions';
import { CorneredWrapper, Button, Loader } from '/basicComponents';
import { smColors, ipcConsts, nodeConsts } from '/vars';
import styled from 'styled-components';
import { notificationsService } from '/infra/notificationsService';
import type { Action } from '/types';

const Wrapper = styled.div`
position: fixed;
Expand Down Expand Up @@ -45,7 +47,8 @@ const ButtonsWrapper = styled.div`
`;

type Props = {
miningStatus: number
miningStatus: number,
logout: Action
};

type State = {
Expand Down Expand Up @@ -109,8 +112,10 @@ class OnQuitModal extends Component<Props, State> {
};

handleKeepInBackground = () => {
const { logout } = this.props;
this.setState({ isVisible: false });
ipcRenderer.send(ipcConsts.KEEP_RUNNING_IN_BACKGROUND);
logout();
setTimeout(() => {
notificationsService.notify({
title: 'Spacemesh',
Expand All @@ -124,5 +129,9 @@ const mapStateToProps = (state) => ({
miningStatus: state.node.miningStatus
});

OnQuitModal = connect<any, any, _, _, _, _>(mapStateToProps)(OnQuitModal);
const mapDispatchToProps = {
logout
};

OnQuitModal = connect<any, any, _, _, _, _>(mapStateToProps, mapDispatchToProps)(OnQuitModal);
export default OnQuitModal;

0 comments on commit fdc25d6

Please sign in to comment.