1
0
Fork 0
mirror of https://github.com/muerwre/vault-frontend.git synced 2025-05-04 00:56:40 +07:00

boris: refactored sagas

This commit is contained in:
Fedor Katurov 2021-03-02 15:49:57 +07:00
parent 20dead5ef5
commit 90ac1fe611
2 changed files with 10 additions and 11 deletions

View file

@ -5,15 +5,17 @@ import { getBorisGitStats, getBorisBackendStats } from './api';
import { Unwrap } from '../types';
function* loadStats() {
yield put(borisSetStats({ is_loading: true }));
try {
yield put(borisSetStats({ is_loading: true }));
const git: Unwrap<typeof getBorisGitStats> = yield call(getBorisGitStats);
const backend: Unwrap<typeof getBorisBackendStats> = yield call(getBorisBackendStats);
yield put(borisSetStats({ git, backend: backend.data, is_loading: false }));
yield put(borisSetStats({ git, backend }));
} catch (e) {
yield put(borisSetStats({ git: [], backend: null, is_loading: false }));
yield put(borisSetStats({ git: [], backend: undefined }));
} finally {
yield put(borisSetStats({ is_loading: false }));
}
}