mirror of
https://github.com/wassname/talk.git
synced 2026-08-03 13:20:59 +08:00
Fixed install state.
This commit is contained in:
@@ -95,10 +95,10 @@ const checkInstallFailure = error => ({type: actions.CHECK_INSTALL_FAILURE, erro
|
||||
|
||||
export const checkInstall = next => dispatch => {
|
||||
dispatch(checkInstallRequest());
|
||||
coralApi('/setup/available')
|
||||
.then(({available}) => {
|
||||
dispatch(checkInstallSuccess(available));
|
||||
if (!available) {
|
||||
coralApi('/setup')
|
||||
.then(({installed}) => {
|
||||
dispatch(checkInstallSuccess(installed));
|
||||
if (installed) {
|
||||
next();
|
||||
}
|
||||
})
|
||||
|
||||
@@ -84,7 +84,7 @@ export default function install (state = initialState, action) {
|
||||
});
|
||||
case actions.CHECK_INSTALL_SUCCESS:
|
||||
return state
|
||||
.set('alreadyInstalled', !action.available);
|
||||
.set('alreadyInstalled', action.installed);
|
||||
default :
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -4,14 +4,14 @@ const SetupService = require('../../../services/setup');
|
||||
|
||||
const router = express.Router();
|
||||
|
||||
router.get('/available', (req, res, next) => {
|
||||
router.get('/', (req, res, next) => {
|
||||
SetupService
|
||||
.isAvailable()
|
||||
.then(() => {
|
||||
res.json({available: true});
|
||||
res.json({installed: false});
|
||||
})
|
||||
.catch(() => {
|
||||
res.json({available: false});
|
||||
res.json({installed: true});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user