cornflourblue / react-signup-verification-boilerplate

React Boilerplate - Email Sign Up with Verification, Authentication & Forgot Password
https://jasonwatmore.com/post/2020/04/22/react-email-sign-up-with-verification-authentication-forgot-password
MIT License
200 stars 110 forks source link

Not loading for Safari or FireFox #6

Open calstu99 opened 4 years ago

calstu99 commented 4 years ago

Boilerplate is not loading for Safari/FireFox. Works only with Chrome. After $npm install and $npm start:

Safari Error: TypeError: _servicesWEBPACK_IMPORTED_MODULE_4__["accountService"].refreshToken()["finally"] is not a function. (In '_servicesWEBPACK_IMPORTED_MODULE_4["accountService"].refreshToken()"finally"', '_services__WEBPACK_IMPORTED_MODULE_4["accountService"].refreshToken()["finally"]' is undefined)

FireFox Error: [14:45:42.900] The connection to ws://localhost:8080/sockjs-node/610/emmylzf3/websocket was interrupted while the page was loading. @ http://localhost:8080/main.js:7128

calstu99 commented 4 years ago

Great boilerplate! However currently only runs in Chrome.

For it to work in Safari/FireFox, need to disable ".Finally" and use ".then" to handle asynchronous call from backend service (refreshToken()).

//accountService.refreshToken().finally(startApp); //original //accountService.refreshToken().then(startApp); //new

startApp(); // remove refreshToken() for mobile to work.

May need to rewrite using asynchronous call.. ie. wrapped in try catch after resolving or rejection for this to work in Safari/Firefox. Could be a bug with bundler or in Safari/Firefox

(async () => { try { // do something } catch (error) { console.log(error); } finally { // render App

}