I have a site which is run behind a node proxy. One part of the site loads data using <Query>
of the react-apollo library. For some reason, whenever I refresh the page, the PHPSESSID cookie is not maintained and is changed everytime. But if I put the RightPanel
component outside of a <Query>
tag, session is maintained.
Please help
<Query query={GQL_CURRENT_USER}>
{({ loading, error, data }) => {
if (loading) return <div>Chargement...</div>;
if (error) return <div>Erreur...</div>;
// user not exist or problem fetching
if (data.User === null) return <div>Error while loading user.</div>
return (
<div className="main-container">
<UserContext.Provider value={{
currentUser: data.User,
currentStructure
}}>
<RightPanel />
</UserContext.Provider>
</div>
)
}}
</Query>
Inside RightPanel
load dynamically an iframe
return (
<main className={classes.root}>
<div className={classes.container}>
<Switch>
<Route exact path="/">
<Redirect to="/user/suivi" />
</Route>
<Route render={() => {
const hash = window.location.hash.substr(2).split("/");
return <LegacyView path={hash}></LegacyView>
}}>
</Route>
</Switch>
</div>
</main>
)
LegacyView render
render() {
return <iframe ref={this.iframe} onLoad={() => this.frameLoaded()} styleName="LegacyView" src={`${LegacyView.BASE_URL}${this.state.url}`} />
}