mirror of
https://github.com/ToolJet/ToolJet
synced 2026-05-15 21:18:24 +00:00
Fixes for public applications
This commit is contained in:
parent
2787d9efd5
commit
c58f01eb52
3 changed files with 17 additions and 11 deletions
|
|
@ -36,7 +36,17 @@ class Editor extends React.Component {
|
|||
super(props);
|
||||
|
||||
const appId = this.props.match.params.id;
|
||||
|
||||
const currentUser = authenticationService.currentUserValue;
|
||||
let userVars = { };
|
||||
|
||||
if(currentUser) {
|
||||
userVars = {
|
||||
email: currentUser.email,
|
||||
firstName: currentUser.first_name,
|
||||
lastName: currentUser.last_name
|
||||
};
|
||||
}
|
||||
|
||||
this.state = {
|
||||
currentUser: authenticationService.currentUserValue,
|
||||
|
|
@ -57,11 +67,7 @@ class Editor extends React.Component {
|
|||
queries: {},
|
||||
components: {},
|
||||
globals: {
|
||||
currentUser: {
|
||||
firstName: currentUser.first_name,
|
||||
lastName: currentUser.last_name,
|
||||
email: currentUser.email
|
||||
},
|
||||
currentUser: userVars,
|
||||
urlparams: {}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ class ManageAppUsers extends React.Component {
|
|||
}
|
||||
|
||||
fetchAppUsers = () => {
|
||||
appService.getAppUsers(this.state.app.id).then((data) => this.setState({
|
||||
appService.getAppUsers(this.props.app.id).then((data) => this.setState({
|
||||
users: data.users,
|
||||
isLoading: false
|
||||
}));
|
||||
|
|
|
|||
|
|
@ -7,11 +7,11 @@ export const PrivateRoute = ({ component: Component, ...rest }) => (
|
|||
<Route
|
||||
{...rest}
|
||||
render={(props) => {
|
||||
// const currentUser = authenticationService.currentUserValue;
|
||||
// if (!currentUser) {
|
||||
// // not logged in so redirect to login page with the return url
|
||||
// return <Redirect to={{ pathname: '/login', state: { from: props.location } }} />;
|
||||
// }
|
||||
const currentUser = authenticationService.currentUserValue;
|
||||
if (!currentUser && !props.location.pathname.startsWith('/applications/')) {
|
||||
// not logged in so redirect to login page with the return url
|
||||
return <Redirect to={{ pathname: '/login', state: { from: props.location } }} />;
|
||||
}
|
||||
|
||||
// authorised so return component
|
||||
return <Component {...props} />;
|
||||
|
|
|
|||
Loading…
Reference in a new issue