Skip to content

Commit

Permalink
Fixing a error when going to a document
Browse files Browse the repository at this point in the history
  • Loading branch information
guillecro committed Oct 20, 2023
1 parent 23fae20 commit c940c13
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 14 deletions.
6 changes: 3 additions & 3 deletions components/subscribe-button copy/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ class SubscribeButton extends Component {
// when component initiates, this.props.authContext might not be fullfiled, we need to
// set an interval to check if it is already there
const interval = setInterval(() => {
console.log('Is it loaded?')
// console.log('Is it loaded?')
if (this.props.authContext && this.props.authContext.user && this.props.authContext.user._id) {
console.log('Yes it is')
// console.log('Yes it is')
clearInterval(interval)
this.fetchData()
} else {
console.log('Not yet')
// console.log('Not yet')
}
}, 1000)
}
Expand Down
6 changes: 3 additions & 3 deletions components/subscribe-button-profile/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ class SubscribeButton extends Component {
// when component initiates, this.props.authContext might not be fullfiled, we need to
// set an interval to check if it is already there
const interval = setInterval(() => {
console.log('Is it loaded?')
// console.log('Is it loaded?')
if (this.props.authContext && this.props.authContext.user && this.props.authContext.user._id) {
console.log('Yes it is')
// console.log('Yes it is')
clearInterval(interval)
this.fetchData()
} else {
console.log('Not yet')
// console.log('Not yet')
}
}, 1000)
}
Expand Down
6 changes: 3 additions & 3 deletions components/subscribe-button/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -68,13 +68,13 @@ class SubscribeButton extends Component {
// when component initiates, this.props.authContext might not be fullfiled, we need to
// set an interval to check if it is already there
const interval = setInterval(() => {
console.log('Is it loaded?')
// console.log('Is it loaded?')
if (this.props.authContext && this.props.authContext.user && this.props.authContext.user._id) {
console.log('Yes it is')
// console.log('Yes it is')
clearInterval(interval)
this.fetchData()
} else {
console.log('Not yet')
// console.log('Not yet')
}
}, 1000)
}
Expand Down
3 changes: 2 additions & 1 deletion containers/general-container/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@ class GeneralContainer extends Component {

componentDidMount () {
if (!this.props.authContext.keycloak) return
if (this.props.authContext.user.roles.includes('admin')) {this.setState({isAdmin: true})}
// if (!this.props.authContext.user) return
if (this.authContext.authenticated && this.props.authContext.user && this.props.authContext.user.roles.includes('admin')) {this.setState({isAdmin: true})}
this.fetchDocument(this.props.project, this.props.authContext.keycloak.token)
}

Expand Down
8 changes: 4 additions & 4 deletions containers/my-notifications-settings/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -176,21 +176,21 @@ class MyNotificationsSettings extends Component {
}

async componentDidMount () {
console.log('HELP ME')
// console.log('HELP ME')
// if (this.props.authContext && this.props.authContext.user && this.props.authContext.user._id) {
// await this.fetchData()
// }

// when component initiates, this.props.authContext might not be fullfiled, we need to
// set an interval to check if it is already there
const interval = setInterval(() => {
console.log('Is it loaded?')
// console.log('Is it loaded?')
if (this.props.authContext && this.props.authContext.user && this.props.authContext.user._id) {
console.log('Yes it is')
// console.log('Yes it is')
clearInterval(interval)
this.fetchData()
} else {
console.log('Not yet')
// console.log('Not yet')
}
}, 1000)
}
Expand Down

0 comments on commit c940c13

Please sign in to comment.