accounts-frontend/src/pages/dev/ApplicationsListPage.js
ErickSkrauch cf3a33937a Implemented UI for Accounts applications management.
Introduced copy service and injected it usage into auth finish page.
Introduced Collapse component.
Introduced Radio component.
Generalized Checkbox component to share Radio component styles.
Improved Textarea component: it now has auto height functionality.
Improved profile/BackButton component: now you can pass custom url.
BSOD is no longer displayed on 404 response.
2018-03-25 22:23:59 +03:00

62 lines
1.5 KiB
JavaScript

// @flow
import React, { Component } from 'react';
import ApplicationsIndex from 'components/dev/apps/ApplicationsIndex';
import type { User } from 'components/user';
import type { OauthAppResponse } from 'services/api/oauth';
class ApplicationsListPage extends Component<{
user: User,
apps: Array<OauthAppResponse>,
fetchAvailableApps: () => Promise<*>,
deleteApp: (string) => Promise<*>,
resetApp: (string, bool) => Promise<*>,
}, {
isLoading: bool,
}> {
static displayName = 'ApplicationsListPage';
state = {
appsList: [],
isLoading: false,
};
componentWillMount() {
!this.props.user.isGuest && this.loadApplicationsList();
}
render() {
const { user, apps, resetApp, deleteApp } = this.props;
const { isLoading } = this.state;
return (
<ApplicationsIndex
displayForGuest={user.isGuest}
applications={apps}
isLoading={isLoading}
deleteApp={deleteApp}
resetApp={resetApp}
/>
);
}
loadApplicationsList = async () => {
this.setState({isLoading: true});
await this.props.fetchAvailableApps();
this.setState({isLoading: false});
};
}
import { connect } from 'react-redux';
import { fetchAvailableApps, resetApp, deleteApp } from 'components/dev/apps/actions';
export default connect((state) => ({
user: state.user,
apps: state.apps.available,
}), {
fetchAvailableApps,
resetApp,
deleteApp,
})(ApplicationsListPage);