fixes typos

This commit is contained in:
zmagod 2017-10-19 15:48:21 +02:00
parent 7943bfda13
commit 09e4e23e3d
5 changed files with 24 additions and 21 deletions

View file

@ -27,6 +27,8 @@ type State = {
active: string active: string
} }
let componentMounted = false;
export default class SettingsPage extends Component<*, State> { export default class SettingsPage extends Component<*, State> {
constructor(props: *) { constructor(props: *) {
super(props); super(props);
@ -38,8 +40,16 @@ export default class SettingsPage extends Component<*, State> {
(this: any).setTabState = this.setTabState.bind(this); (this: any).setTabState = this.setTabState.bind(this);
} }
componentDidMount(): void {
componentMounted = true;
}
componentWillUnmount(): void {
componentMounted = false;
}
setTabState(tab: string): void { setTabState(tab: string): void {
if (tab !== this.state.active) { if (tab !== this.state.active && componentMounted) {
(this: any).setState({ active: tab }); (this: any).setState({ active: tab });
} }
} }

View file

@ -26,8 +26,8 @@ class RemoveUserModal extends Component<Props> {
} }
removeUser(): void { removeUser(): void {
const { team_id, team_user_id } = this.props.userToRemove; const { teamId, teamUserId } = this.props.userToRemove;
removeUserFromTeam(team_id, team_user_id) removeUserFromTeam(teamId, teamUserId)
.then(response => { .then(response => {
this.props.updateUsersCallback(response); this.props.updateUsersCallback(response);
this.props.hideModal(); this.props.hideModal();

View file

@ -10,7 +10,7 @@ import {
MenuItem MenuItem
} from "react-bootstrap"; } from "react-bootstrap";
import styled from "styled-components"; import styled from "styled-components";
import type { Teams$TeamMember, Teams$TeamMemberActions } from "flow-typed"; import type { Teams$TeamMember, Team$TeamMemeber, Teams$TeamMemberActions } from "flow-typed";
import { FormattedMessage } from "react-intl"; import { FormattedMessage } from "react-intl";
import { updateUserTeamRole } from "../../../../../services/api/user_team_api"; import { updateUserTeamRole } from "../../../../../services/api/user_team_api";
@ -25,9 +25,9 @@ const StyledButton = styled(Button)`
const initalUserToRemove = { const initalUserToRemove = {
userName: "", userName: "",
team_user_id: 0, teamUserId: 0,
teamName: "", teamName: "",
team_id: 0 teamId: 0
}; };
type Team = { type Team = {
@ -35,13 +35,6 @@ type Team = {
name: string name: string
}; };
type UserToRemove = {
userName: string,
team_user_id: number,
teamName: string,
team_id: number
};
type TableColumns = { type TableColumns = {
name: string, name: string,
email: string, email: string,
@ -60,7 +53,7 @@ type Props = {
type State = { type State = {
showModal: boolean, showModal: boolean,
showInviteUsersModal: boolean, showInviteUsersModal: boolean,
userToRemove: UserToRemove userToRemove: Team$TeamMemeber
}; };
class TeamsMembers extends Component<Props, State> { class TeamsMembers extends Component<Props, State> {
@ -159,9 +152,9 @@ class TeamsMembers extends Component<Props, State> {
onClick={() => { onClick={() => {
this.userToRemove({ this.userToRemove({
userName: row.name, userName: row.name,
team_user_id: data.teamUserId, teamUserId: data.teamUserId,
teamName: this.props.team.name, teamName: this.props.team.name,
team_id: this.props.team.id teamId: this.props.team.id
}); });
}} }}
> >

View file

@ -101,7 +101,7 @@ class SettingsTeam extends Component<Props, State> {
(this: any).updateUsersCallback = this.updateUsersCallback.bind(this); (this: any).updateUsersCallback = this.updateUsersCallback.bind(this);
(this: any).showNameModal = this.showNameModal.bind(this); (this: any).showNameModal = this.showNameModal.bind(this);
(this: any).hideNameModalCallback = this.hideNameModalCallback.bind(this); (this: any).hideNameModalCallback = this.hideNameModalCallback.bind(this);
(this: any).renderEditNameModel = this.renderEditNameModel.bind(this); (this: any).renderEditNameModal = this.renderEditNameModal.bind(this);
} }
componentDidMount(): void { componentDidMount(): void {
@ -149,7 +149,7 @@ class SettingsTeam extends Component<Props, State> {
); );
} }
renderEditNameModel() { renderEditNameModal() {
if (this.state.showNameModal) { if (this.state.showNameModal) {
return ( return (
<UpdateTeamNameModal <UpdateTeamNameModal
@ -243,7 +243,7 @@ class SettingsTeam extends Component<Props, State> {
team={this.state.team} team={this.state.team}
updateTeamCallback={this.updateTeamCallback} updateTeamCallback={this.updateTeamCallback}
/> />
{this.renderEditNameModel()} {this.renderEditNameModal()}
</Wrapper> </Wrapper>
); );
} }

View file

@ -2,7 +2,7 @@
export type Team$TeamMemeber = { export type Team$TeamMemeber = {
userName: string, userName: string,
team_user_id: number, teamUserId: number,
teamName: string, teamName: string,
team_id: number teamId: number
}; };