diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index fb587f89..0a6276eb 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -3,7 +3,7 @@ stages: - bundle variables: - VERSION: 0.0.5 + VERSION: 0.0.6 build-go: image: golang:1.16.2 diff --git a/docs/changelog.md b/docs/changelog.md index 835b0988..19a35080 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -1,3 +1,7 @@ +# 0.0.6 +- Fix hitting dashboard when logged out +- Clean up app.js + # 0.0.5 - Only allow ItemType:Audio from Jellyfin - Fix NavBar for Mobile (Ugly hack but.. TO REWORK) diff --git a/web/src/Actions/auth.js b/web/src/Actions/auth.js index 606e31ee..8f37d2f4 100644 --- a/web/src/Actions/auth.js +++ b/web/src/Actions/auth.js @@ -3,11 +3,13 @@ import { REGISTER_FAIL, LOGIN_SUCCESS, LOGIN_FAIL, - } from "./types"; + LOGOUT, +} from "./types"; import { toast } from 'react-toastify'; import jwt from 'jwt-decode' import AuthService from "../Services/auth.service"; + import eventBus from "./eventBus"; export const register = (username, email, password) => (dispatch) => { return AuthService.register(username, email, password).then( @@ -85,12 +87,19 @@ import { ); }; - export const logout = () => (dispatch) => { - AuthService.logout(); + export const logout = (dispatch) => { + // Clear local data + AuthService.logout() - // dispatch({ - // type: LOGOUT, - // }); + // window.location.pathname("/") + window.location.reload() - window.location.reload(); + // TODO; Clear Redux - ENABLE THIS WHEN I FIGURE OUT HOW 2 DISPATCH + // dispatch({ + // type: LOGOUT, + // payload: {}, + // }); + + // // Issue to all listeners to reload + eventBus.dispatch(LOGOUT); }; diff --git a/web/src/App.js b/web/src/App.js index 657fc525..02c1c903 100644 --- a/web/src/App.js +++ b/web/src/App.js @@ -12,52 +12,23 @@ import Navigation from './Components/Navigation'; // import { logout } from './Actions/auth'; import { Route, Switch, withRouter } from 'react-router-dom'; -import { connect } from 'react-redux'; import { Component } from 'react'; import 'bootstrap/dist/css/bootstrap.min.css'; -function mapStateToProps(state) { - const { user } = state.auth; - return { - user, - }; -} - class App extends Component { constructor(props) { super(props); - // this.logOut = this.logOut.bind(this); - this.state = { - // showAdminBoard: false, - // currentUser: undefined, - // Don't even ask.. apparently you can't pass - // exact="true".. it has to be a bool :| true: true, }; } - - - // componentDidMount() { - // const user = this.props.user; - - // if (user) { - // this.setState({ - // currentUser: user, - // }); - // } - // } - - // logOut() { - // this.props.dispatch(logout()); - // } render() { return (
- + @@ -68,9 +39,11 @@ class App extends Component { +
); } } -export default withRouter(connect(mapStateToProps)(App)); \ No newline at end of file + +export default withRouter(App); \ No newline at end of file diff --git a/web/src/Components/Navigation.js b/web/src/Components/Navigation.js index 56c65e3b..f8f93239 100644 --- a/web/src/Components/Navigation.js +++ b/web/src/Components/Navigation.js @@ -30,10 +30,11 @@ class Navigation extends Component { constructor(props) { super(props); this.toggleNavbar = this.toggleNavbar.bind(this); + this.handleLogout = this.handleLogout.bind(this); // Yeah I know you might not hit home.. but I can't get the // path based finder thing working on initial load :sweatsmile: - this.state = { active: "Home", collapsed: true}; + this.state = { active: "Home", collapsed: true }; } componentDidMount() { @@ -55,13 +56,16 @@ class Navigation extends Component { componentWillUnmount() { eventBus.remove(LOGIN_SUCCESS); - eventBus.remove(LOGOUT); } _handleClick(menuItem) { this.setState({ active: menuItem, collapsed: !this.state.collapsed }); } + handleLogout() { + this.dispatch(logout()); + } + toggleNavbar() { this.setState({ collapsed: !this.state.collapsed }); } @@ -94,7 +98,7 @@ class Navigation extends Component { onClick={this._handleClick.bind(this, "profile")} className="navLinkMobile" >Profile - Logout + Logout :