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");
|
const ticket = urlParams.get("ticket");
|
||||||
|
|
||||||
if (!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 } });
|
this.setState({ user: { ticket } });
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
logout() {
|
logout() {
|
||||||
|
this.redirectToCASLogoutService();
|
||||||
|
}
|
||||||
|
|
||||||
|
redirectToCASLogoutService() {
|
||||||
window.location.replace(`https://cas.amu.edu.pl/cas/logout?service=${window.origin}`);
|
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() {
|
render() {
|
||||||
return (
|
return (
|
||||||
<BusinessLogicContext.Provider
|
<BusinessLogicContext.Provider
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
export type User = {
|
export type User = {
|
||||||
name?: string;
|
name?: string;
|
||||||
surname?: string;
|
surname?: string;
|
||||||
ticket: string;
|
ticket: string | null;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user