From c940c13be1ff48854d82dda06a473cb2ec5fc54e Mon Sep 17 00:00:00 2001 From: Guillermo Croppi Date: Fri, 20 Oct 2023 17:19:18 -0300 Subject: [PATCH] Fixing a error when going to a document --- components/subscribe-button copy/component.js | 6 +++--- components/subscribe-button-profile/component.js | 6 +++--- components/subscribe-button/component.js | 6 +++--- containers/general-container/component.js | 3 ++- containers/my-notifications-settings/component.js | 8 ++++---- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/components/subscribe-button copy/component.js b/components/subscribe-button copy/component.js index a061353..fe09d57 100644 --- a/components/subscribe-button copy/component.js +++ b/components/subscribe-button copy/component.js @@ -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) } diff --git a/components/subscribe-button-profile/component.js b/components/subscribe-button-profile/component.js index da4a05c..f15da25 100644 --- a/components/subscribe-button-profile/component.js +++ b/components/subscribe-button-profile/component.js @@ -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) } diff --git a/components/subscribe-button/component.js b/components/subscribe-button/component.js index df6ab79..b1893a0 100644 --- a/components/subscribe-button/component.js +++ b/components/subscribe-button/component.js @@ -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) } diff --git a/containers/general-container/component.js b/containers/general-container/component.js index c4ec450..2d895cd 100644 --- a/containers/general-container/component.js +++ b/containers/general-container/component.js @@ -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) } diff --git a/containers/my-notifications-settings/component.js b/containers/my-notifications-settings/component.js index 316a46b..f6200aa 100644 --- a/containers/my-notifications-settings/component.js +++ b/containers/my-notifications-settings/component.js @@ -176,7 +176,7 @@ 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() // } @@ -184,13 +184,13 @@ class MyNotificationsSettings 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) }