fixed: login not closing
This commit is contained in:
1 parent
d3638a10d7
commit
1ca53d7bea
2 files changed
+11
-14
No files matched your search
@@ -1,5 +1,5 @@
|
||||
REACT_APP_WS_SERVER=wss://radio.rolniknysa.pl/ws/
|
||||
REACT_APP_DOMAIN=radio-rolnik.mtps.pl
|
||||
REACT_APP_DOMAIN=radio.rolniknysa.pl
|
||||
REACT_APP_NAME=radio-rolnik
|
||||
|
||||
REACT_APP_SPOTIFY_REDIRECTURI=http://radio.rolniknysa.pl/api/login/token
|
||||
REACT_APP_FB_REDIRECTURI=https://radio.rolniknysa.pl/api/login/token
|
||||
+9
-12
@@ -2,7 +2,7 @@ import Jwt from 'jsonwebtoken'
|
||||
import localStorage from 'local-storage'
|
||||
|
||||
const appId = '299948451430584',
|
||||
redirectUri = process.env.REACT_APP_SPOTIFY_REDIRECTURI,
|
||||
redirectUri = process.env.REACT_APP_FB_REDIRECTURI,
|
||||
state = 'stejt'
|
||||
|
||||
var credentials = {
|
||||
@@ -17,19 +17,16 @@ function promptLogin() {
|
||||
`Zaloguj się przez Facebook`,
|
||||
`scrollbars=no,resizable=no,status=no,location=no,toolbar=no,menubar=no,width=400,height=550`
|
||||
)
|
||||
window.exit = ({ jwt }) => {
|
||||
popup.close()
|
||||
|
||||
credentials = {
|
||||
token: jwt,
|
||||
udata: Jwt.decode(jwt),
|
||||
let interval = setInterval(() => {
|
||||
if (popup.closed) {
|
||||
resolve({
|
||||
token: localStorage('token'),
|
||||
udata: localStorage('udata'),
|
||||
})
|
||||
clearInterval(interval)
|
||||
}
|
||||
|
||||
localStorage('token', credentials.token)
|
||||
localStorage('udata', credentials.udata)
|
||||
|
||||
resolve(credentials)
|
||||
}
|
||||
}, 500)
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user