Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function *handle_user_signout() {
const { _t } = app.context
try{
yield api({ name: 'auth/logout' }).save({})
yield put({ type: '@@xadmin/AUTH_SIGN_OUT_FINISH' })
yield put({ type: '@@xadmin/ADD_NOTICE', payload: {
type: 'success', headline: 'Success', message: _t('Successfully logged out')
} })
} catch(err) {
app.error(err)
}
}
function *handle_get_userinfo({ type }) {
try{
const user = yield api({ name: 'auth' }).get('user')
yield put({ type, payload: user, success: true })
} catch(err) {
app.error(err)
}
}
function *handle_verify_email({ payload }) {
const { _t } = app.context
try {
yield api({ name: 'auth/registration/verify-email' }).save({
language: 'zh_CN',
...payload
})
yield put({ type: '@@xadmin/ADD_NOTICE', payload: {
type: 'success', headline: 'Success', message: _t('Send verify code to your email, please check')
} })
} catch(err) {
app.error(err)
}
}