merge repository heads

This commit is contained in:
Sebastian Sdorra
2018-07-24 14:48:20 +02:00
6 changed files with 151 additions and 26 deletions

View File

@@ -1,9 +1,8 @@
//@flow
import React from "react";
import type { Me } from "../types/me";
type Props = {
me?: Me
me?: string
};
class Footer extends React.Component<Props> {
@@ -15,7 +14,7 @@ class Footer extends React.Component<Props> {
return (
<footer className="footer">
<div className="container is-centered">
<p className="has-text-centered">{me.username}</p>
<p className="has-text-centered">{me}</p>
</div>
</footer>
);

View File

@@ -18,6 +18,7 @@ type Props = {
error: Error,
loading: boolean,
authenticated?: boolean,
displayName: string,
t: string => string,
fetchMe: () => void
};
@@ -28,7 +29,7 @@ class App extends Component<Props> {
}
render() {
const { entry, loading, error, t, authenticated } = this.props;
const { loading, error, authenticated, displayName, t } = this.props;
let content;
const navigation = authenticated ? <PrimaryNavigation /> : "";
@@ -50,7 +51,7 @@ class App extends Component<Props> {
<div className="App">
<Header>{navigation}</Header>
{content}
<Footer me={entry} />
<Footer me={displayName} />
</div>
);
}
@@ -64,10 +65,17 @@ const mapDispatchToProps = (dispatch: any) => {
const mapStateToProps = state => {
let mapped = state.auth.me || {};
let displayName;
if (state.auth.login) {
mapped.authenticated = state.auth.login.authenticated;
}
return mapped;
if (state.auth.me && state.auth.me.entry) {
displayName = state.auth.me.entry.entity.displayName;
}
return {
...mapped,
displayName
};
};
export default withRouter(

View File

@@ -1,4 +0,0 @@
// @flow
export type Me = {
username: string
};

View File

@@ -25,6 +25,7 @@ export const DELETE_USER_SUCCESS = "scm/users/DELETE_SUCCESS";
export const DELETE_USER_FAILURE = "scm/users/DELETE_FAILURE";
const USERS_URL = "users";
const USER_URL = "users/";
const CONTENT_TYPE_USER = "application/vnd.scmm-user+json;v=2";