refacto notifications redirection
This commit is contained in:
parent
4cf0bdb1e8
commit
15ec6037c1
@ -34,7 +34,7 @@ export default function Navigation() {
|
||||
}, []);
|
||||
|
||||
const getNotifications = useCallback(async () => {
|
||||
await getAnchoringStatus();
|
||||
//await getAnchoringStatus();
|
||||
const notifications = await Notifications.getInstance().get({
|
||||
where: {
|
||||
read: false,
|
||||
@ -47,11 +47,12 @@ export default function Navigation() {
|
||||
redirectUrl: notification.notification.redirection_url,
|
||||
});
|
||||
});
|
||||
}, [getAnchoringStatus]);
|
||||
}, []);
|
||||
|
||||
useEffect(() => {
|
||||
getAnchoringStatus();
|
||||
getNotifications();
|
||||
}, [pathname, getNotifications]);
|
||||
}, [pathname, getNotifications, getAnchoringStatus]);
|
||||
|
||||
return (
|
||||
<div className={classes["root"]}>
|
||||
|
@ -108,10 +108,12 @@ class ToastElementClass extends React.Component<IPropsClass, IState> {
|
||||
}, 200);
|
||||
}
|
||||
|
||||
private handleClick(e: React.MouseEvent) {
|
||||
private async handleClick(e: React.MouseEvent) {
|
||||
console.log('redirectUrl', this.props.toast.redirectUrl);
|
||||
if (this.props.toast.redirectUrl) {
|
||||
this.props.router.push(this.props.toast.redirectUrl);
|
||||
this.onClose(e);
|
||||
await this.props.router.push(this.props.toast.redirectUrl);
|
||||
this.props.router.reload();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ type IProps = {};
|
||||
type IState = {
|
||||
toastList: IToast[];
|
||||
};
|
||||
export default class ToastsContainer extends React.Component<IProps, IState> {
|
||||
export class ToastsContainerClass extends React.Component<IProps, IState> {
|
||||
private removeOnChange = () => {};
|
||||
|
||||
public constructor(props: IProps) {
|
||||
@ -25,7 +25,7 @@ export default class ToastsContainer extends React.Component<IProps, IState> {
|
||||
<div className={classNames(classes["root"], this.state.toastList.length > 0 && classes["open"])}>
|
||||
<>
|
||||
{this.state.toastList.map((toast) => {
|
||||
return <ToastElement toast={toast} key={toast.id} />;
|
||||
return <ToastElement toast={toast} key={toast.id}/>;
|
||||
})}
|
||||
</>
|
||||
</div>
|
||||
@ -44,3 +44,7 @@ export default class ToastsContainer extends React.Component<IProps, IState> {
|
||||
this.setState({ toastList });
|
||||
}
|
||||
}
|
||||
|
||||
export default function ToastsContainer(props: IProps) {
|
||||
return <ToastsContainerClass {...props}/>;
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user