Skip to content

Instantly share code, notes, and snippets.

@RaymondBenc
Created September 25, 2019 15:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save RaymondBenc/ef7819825af1b2be10cc6297eaf6aff9 to your computer and use it in GitHub Desktop.
Save RaymondBenc/ef7819825af1b2be10cc6297eaf6aff9 to your computer and use it in GitHub Desktop.
Override Unite Profile Controller
import React from 'react';
import Controller from '@SE/Core/Page/Controller';
import app from '@SE/Core/App';
import ProfileService from '@SE/Profile/Service/ProfileService';
import Loader from '@SE/Core/Loader';
export default class Component extends React.Component {
static propTypes = {};
constructor (props) {
super(props);
this.state = {
ready: false,
user: null
};
}
componentDidMount () {
ProfileService.get(this);
}
componentDidCatch (error, info) {
app.withException(error, info);
}
render () {
if (!this.state.ready) {
return <Loader type="section" />;
}
return (
<Controller {...ProfileService.getControllerProps(this, {
route: 'profile',
params: {
route: 'profile'
}
})}>
<div className="p-3 mb-5 bg-primary text-white">
PRIMARY CONTENT
</div>
</Controller>
);
}
}
@RaymondBenc
Copy link
Author

The above file View.js, for this example would be placed located in: /src/HelloWorld/Controller/View.js. No route is needed to be created in DevOps, simply created the file manually.

When managing your product add the following to COMPONENT REPLACEMENTS:

{
    "@SE/Profile/Controller/View.js": "@Acme/HelloWorld/Controller/View.js"
}

Screenshot 2019-09-25 at 17 46 58

Successfully adding this will render something similar to:
Screenshot 2019-09-25 at 17 47 31

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment