feat: prepare for push notification
This commit is contained in:
24
src/Flows.js
24
src/Flows.js
@@ -9,6 +9,7 @@ import {
|
||||
ClickHandler,
|
||||
ColoredSpan,
|
||||
HighlightedMarkdown,
|
||||
get_push_subscription,
|
||||
} from './Common';
|
||||
import './Flows.css';
|
||||
import LazyLoad, { forceCheck } from 'react-lazyload';
|
||||
@@ -749,6 +750,29 @@ class FlowSidebar extends PureComponent {
|
||||
</a>
|
||||
</span>
|
||||
)}
|
||||
{!!this.props.token && !!this.state.attention && (
|
||||
<span>
|
||||
<a
|
||||
href="###"
|
||||
style={{ display: 'none' }}
|
||||
onClick={() => {
|
||||
console.log('set notifi');
|
||||
get_push_subscription().then((sc) => {
|
||||
if (!sc) return;
|
||||
fetch('/_test', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
body: JSON.stringify(sc),
|
||||
});
|
||||
});
|
||||
}}
|
||||
>
|
||||
<span className="icon icon-star">提醒</span>
|
||||
</a>
|
||||
</span>
|
||||
)}
|
||||
</div>
|
||||
{!!this.state.filter_name && (
|
||||
<div className="box box-tip flow-item filter-name-bar">
|
||||
|
||||
Reference in New Issue
Block a user