init
This commit is contained in:
37
app/components/login-webview.tsx
Normal file
37
app/components/login-webview.tsx
Normal file
@@ -0,0 +1,37 @@
|
||||
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%' }}
|
||||
/>
|
||||
);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user