Files
poe-auto-pricer/app/components/login-webview.tsx
2018-08-14 00:02:06 -05:00

38 lines
776 B
TypeScript

import { WebviewTag } from 'electron';
import React from 'react';
interface IProps {
onSuccess: () => void;
}
export class LoginWebview extends React.Component<IProps, any> {
private webview: WebviewTag;
constructor(props: IProps) {
super(props);
}
componentDidMount() {
this.webview = this.refs['webview'] as any;
this.webview.addEventListener('did-stop-loading', this.didStopLoading);
}
didStopLoading = (event: any) => {
if ((event.target.src as string).includes('my-account')) {
this.props.onSuccess();
}
};
render() {
return (
<webview
ref="webview"
partition="persist:poe"
src="https://www.pathofexile.com/login"
style={{ height: '100%', width: '100%' }}
/>
);
}
}