mirror of
https://github.com/elyby/accounts-frontend.git
synced 2024-12-24 05:59:51 +05:30
#48: add loader during account switching
This commit is contained in:
parent
1449d1ac79
commit
78132e9adb
@ -4,6 +4,7 @@ import classNames from 'classnames';
|
||||
import { Link } from 'react-router';
|
||||
import { FormattedMessage as Message } from 'react-intl';
|
||||
|
||||
import loader from 'services/loader';
|
||||
import { skins, SKIN_DARK, COLOR_WHITE } from 'components/ui';
|
||||
import { Button } from 'components/ui/form';
|
||||
|
||||
@ -137,9 +138,12 @@ export class AccountSwitcher extends Component {
|
||||
onSwitch = (account) => (event) => {
|
||||
event.preventDefault();
|
||||
|
||||
loader.show();
|
||||
|
||||
this.props.switchAccount(account)
|
||||
.then(() => this.props.onAfterAction())
|
||||
.then(() => this.props.onSwitch(account));
|
||||
.then(() => this.props.onSwitch(account))
|
||||
.finally(() => loader.hide());
|
||||
};
|
||||
|
||||
onRemove = (account) => (event) => {
|
||||
|
@ -13,6 +13,7 @@ import { IntlProvider } from 'components/i18n';
|
||||
import routesFactory from 'routes';
|
||||
import storeFactory from 'storeFactory';
|
||||
import bsodFactory from 'components/ui/bsod/factory';
|
||||
import loader from 'services/loader';
|
||||
|
||||
const store = storeFactory();
|
||||
|
||||
@ -52,7 +53,7 @@ Promise.all([
|
||||
|
||||
|
||||
function stopLoading() {
|
||||
document.getElementById('loader').classList.remove('is-active');
|
||||
loader.hide();
|
||||
}
|
||||
|
||||
import scrollTo from 'components/ui/scrollTo';
|
||||
|
9
src/services/loader.js
Normal file
9
src/services/loader.js
Normal file
@ -0,0 +1,9 @@
|
||||
export default {
|
||||
show() {
|
||||
document.getElementById('loader').classList.add('is-active');
|
||||
},
|
||||
|
||||
hide() {
|
||||
document.getElementById('loader').classList.remove('is-active');
|
||||
}
|
||||
};
|
Loading…
Reference in New Issue
Block a user