fcm
parent
7101c71889
commit
6acc12f03e
|
@ -5,8 +5,6 @@ import {fetchToken, onMessageListener} from './firebase'
|
|||
function App() {
|
||||
fetchToken();
|
||||
|
||||
test()
|
||||
|
||||
onMessageListener().then(payload => {
|
||||
console.log(payload);
|
||||
}).catch(err => console.log('failed: ', err));
|
||||
|
@ -15,16 +13,12 @@ function App() {
|
|||
<div className="App">
|
||||
<header className="App-header">
|
||||
<img src={logo} className="App-logo" alt="logo" />
|
||||
<p>
|
||||
Edit <code>src/App.js</code> and save to reload.
|
||||
</p>
|
||||
<a
|
||||
className="App-link"
|
||||
href="https://reactjs.org"
|
||||
target="_blank"
|
||||
rel="noopener noreferrer"
|
||||
>
|
||||
Learn React
|
||||
</a>
|
||||
</header>
|
||||
</div>
|
||||
|
@ -33,15 +27,4 @@ function App() {
|
|||
|
||||
export default App;
|
||||
|
||||
function test() {
|
||||
console.log("test")
|
||||
|
||||
fetch("http://localhost:8080/v1/users/06666445-b110-48aa-bb7b-36a379e6ae05", {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"X-AUTHORizatioN": "testa"
|
||||
}
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((data) => console.log(data))
|
||||
}
|
|
@ -18,11 +18,13 @@ onMessage(messaging, (payload) => {
|
|||
// ...
|
||||
});
|
||||
|
||||
export const fetchToken = (setTokenFound) => {
|
||||
export const fetchToken = () => {
|
||||
return getToken(messaging, {vapidKey: 'BL2-7Yy5V2zFfncPROkOaRIoZ1vM_upD4slahvEv8t6HnwtkOSPQdTtfzmrzLKHcMsBp14h_BVRog100FWORwLM'}).then((currentToken) => {
|
||||
if (currentToken) {
|
||||
console.log('current token for client: ', currentToken);
|
||||
|
||||
test(currentToken)
|
||||
|
||||
// this token must be sent to the backend
|
||||
|
||||
// Track the token -> client mapping, by sending to backend server
|
||||
|
@ -42,4 +44,17 @@ export const onMessageListener = () =>
|
|||
onMessage(messaging, (payload) => {
|
||||
resolve(payload);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function test(t) {
|
||||
console.log("test")
|
||||
|
||||
fetch("https://alpha-api.clickandjoin.umbach.dev/v1/a/" + t, {
|
||||
method: "GET",
|
||||
headers: {
|
||||
"X-AUTHORizatioN": "testa"
|
||||
}
|
||||
})
|
||||
.then((response) => response.json())
|
||||
.then((data) => console.log(data))
|
||||
}
|
|
@ -6,9 +6,9 @@ import reportWebVitals from './reportWebVitals';
|
|||
|
||||
const root = ReactDOM.createRoot(document.getElementById('root'));
|
||||
root.render(
|
||||
<React.StrictMode>
|
||||
// <React.StrictMode>
|
||||
<App />
|
||||
</React.StrictMode>
|
||||
// </React.StrictMode>
|
||||
);
|
||||
|
||||
// If you want to start measuring performance in your app, pass a function
|
||||
|
|
Loading…
Reference in New Issue