finish rudimentary auth flow

This commit is contained in:
41666 2017-12-10 05:26:56 -06:00
parent 90f302c103
commit cfc623b228
10 changed files with 101 additions and 15 deletions

View file

@ -19,7 +19,19 @@ export const userInit = async dispatch => {
})
dispatch(fetchServers)
} catch(e) {
console.log(e)
} catch (e) {
if (!window.location.pathname.startsWith('/oauth')) {
window.location.href = '/oauth/flow'
}
}
}
}
export const userLogout = async dispatch => {
await superagent.post('/api/auth/logout')
dispatch({
type: Symbol.for('reset user')
})
window.location.href = '/'
}