Merge branch 'dev' of https://lab.si.usi.ch/sa4-2020/the-sanmarinoes/frontend into dev
This commit is contained in:
commit
5433b5fd8d
1 changed files with 4 additions and 3 deletions
|
@ -11,7 +11,6 @@ import {
|
||||||
import { connect } from "react-redux";
|
import { connect } from "react-redux";
|
||||||
import { RemoteService, Forms } from "../remote";
|
import { RemoteService, Forms } from "../remote";
|
||||||
import { appActions } from "../storeActions";
|
import { appActions } from "../storeActions";
|
||||||
//import { update } from "immutability-helper";
|
|
||||||
|
|
||||||
class HostModal extends Component {
|
class HostModal extends Component {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
|
@ -23,7 +22,8 @@ class HostModal extends Component {
|
||||||
.then(() => {
|
.then(() => {
|
||||||
this.setState({
|
this.setState({
|
||||||
...this.state,
|
...this.state,
|
||||||
guests: this.props.guests.map((u) => u.id),
|
guests: this.props.guests
|
||||||
|
.map((u) => u.id),
|
||||||
});
|
});
|
||||||
})
|
})
|
||||||
.catch(console.error);
|
.catch(console.error);
|
||||||
|
@ -32,7 +32,7 @@ class HostModal extends Component {
|
||||||
.then((users) =>
|
.then((users) =>
|
||||||
this.setState({
|
this.setState({
|
||||||
...this.state,
|
...this.state,
|
||||||
users: users.map((u) => ({
|
users: users.filter(u => u.id !== this.props.currentUserId).map((u) => ({
|
||||||
key: u.id,
|
key: u.id,
|
||||||
text: `@${u.username} (${u.name})`,
|
text: `@${u.username} (${u.name})`,
|
||||||
value: u.id,
|
value: u.id,
|
||||||
|
@ -127,6 +127,7 @@ const setActiveHost = (activeHost) => {
|
||||||
|
|
||||||
const mapStateToProps = (state) => ({
|
const mapStateToProps = (state) => ({
|
||||||
guests: state.guests,
|
guests: state.guests,
|
||||||
|
currentUserId: state.userInfo.id
|
||||||
});
|
});
|
||||||
const HostModalContainer = connect(
|
const HostModalContainer = connect(
|
||||||
mapStateToProps,
|
mapStateToProps,
|
||||||
|
|
Loading…
Reference in a new issue