Refactored business logic provider
This commit is contained in:
parent
63c85abeb4
commit
9da1dfd51f
@ -30,17 +30,25 @@ class BusinessLogicProvider extends Component<Props, BusinessState> {
|
||||
const ticket = urlParams.get("ticket");
|
||||
|
||||
if (!ticket) {
|
||||
window.location.replace(`https://cas.amu.edu.pl/cas/login?service=${window.origin}&locale=pl`);
|
||||
this.redirectToCASLoginService();
|
||||
}
|
||||
if (ticket && !this.state.user) {
|
||||
if (ticket) {
|
||||
this.setState({ user: { ticket } });
|
||||
}
|
||||
}
|
||||
|
||||
logout() {
|
||||
this.redirectToCASLogoutService();
|
||||
}
|
||||
|
||||
redirectToCASLogoutService() {
|
||||
window.location.replace(`https://cas.amu.edu.pl/cas/logout?service=${window.origin}`);
|
||||
}
|
||||
|
||||
redirectToCASLoginService() {
|
||||
window.location.replace(`https://cas.amu.edu.pl/cas/login?service=${window.origin}&locale=pl`);
|
||||
}
|
||||
|
||||
render() {
|
||||
return (
|
||||
<BusinessLogicContext.Provider
|
||||
|
@ -1,5 +1,5 @@
|
||||
export type User = {
|
||||
name?: string;
|
||||
surname?: string;
|
||||
ticket: string;
|
||||
ticket: string | null;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user