Fixes for public applications

This commit is contained in:
navaneeth 2021-05-07 15:56:51 +05:30
parent 2787d9efd5
commit c58f01eb52
3 changed files with 17 additions and 11 deletions

View file

@ -36,7 +36,17 @@ class Editor extends React.Component {
super(props); super(props);
const appId = this.props.match.params.id; const appId = this.props.match.params.id;
const currentUser = authenticationService.currentUserValue; const currentUser = authenticationService.currentUserValue;
let userVars = { };
if(currentUser) {
userVars = {
email: currentUser.email,
firstName: currentUser.first_name,
lastName: currentUser.last_name
};
}
this.state = { this.state = {
currentUser: authenticationService.currentUserValue, currentUser: authenticationService.currentUserValue,
@ -57,11 +67,7 @@ class Editor extends React.Component {
queries: {}, queries: {},
components: {}, components: {},
globals: { globals: {
currentUser: { currentUser: userVars,
firstName: currentUser.first_name,
lastName: currentUser.last_name,
email: currentUser.email
},
urlparams: {} urlparams: {}
} }
} }

View file

@ -35,7 +35,7 @@ class ManageAppUsers extends React.Component {
} }
fetchAppUsers = () => { fetchAppUsers = () => {
appService.getAppUsers(this.state.app.id).then((data) => this.setState({ appService.getAppUsers(this.props.app.id).then((data) => this.setState({
users: data.users, users: data.users,
isLoading: false isLoading: false
})); }));

View file

@ -7,11 +7,11 @@ export const PrivateRoute = ({ component: Component, ...rest }) => (
<Route <Route
{...rest} {...rest}
render={(props) => { render={(props) => {
// const currentUser = authenticationService.currentUserValue; const currentUser = authenticationService.currentUserValue;
// if (!currentUser) { if (!currentUser && !props.location.pathname.startsWith('/applications/')) {
// // not logged in so redirect to login page with the return url // not logged in so redirect to login page with the return url
// return <Redirect to={{ pathname: '/login', state: { from: props.location } }} />; return <Redirect to={{ pathname: '/login', state: { from: props.location } }} />;
// } }
// authorised so return component // authorised so return component
return <Component {...props} />; return <Component {...props} />;