mirror of
https://github.com/roleypoly/roleypoly-v1.git
synced 2025-06-16 18:29:08 +00:00
finish redux feature parity
This commit is contained in:
parent
f5220aa6dc
commit
5510d5a1c4
29 changed files with 220 additions and 100 deletions
|
@ -14,19 +14,23 @@ export const fetchServers = async dispatch => {
|
|||
}
|
||||
|
||||
export const userInit = async dispatch => {
|
||||
try {
|
||||
const rsp = await superagent.get('/api/auth/user')
|
||||
|
||||
dispatch({
|
||||
type: Symbol.for('set user'),
|
||||
data: rsp.body
|
||||
})
|
||||
if (!window.location.pathname.startsWith('/oauth')) {
|
||||
try {
|
||||
const rsp = await superagent.get('/api/auth/user')
|
||||
|
||||
dispatch(fetchServers)
|
||||
} catch (e) {
|
||||
if (!window.location.pathname.startsWith('/oauth')) {
|
||||
dispatch({
|
||||
type: Symbol.for('set user'),
|
||||
data: rsp.body
|
||||
})
|
||||
|
||||
dispatch(fetchServers)
|
||||
} catch (e) {
|
||||
window.location.href = '/oauth/flow'
|
||||
}
|
||||
} else {
|
||||
dispatch({
|
||||
type: Symbol.for('app ready')
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue