mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 02:56:41 +07:00
document title changes on route load
This commit is contained in:
parent
a04b903206
commit
8391408bb3
3 changed files with 14 additions and 6 deletions
|
@ -1,5 +1,5 @@
|
|||
import { REHYDRATE } from 'redux-persist';
|
||||
import { delay } from 'redux-saga';
|
||||
import { delay, SagaIterator } from 'redux-saga';
|
||||
import { takeLatest, select, call, put, takeEvery, race, take } from 'redux-saga/effects';
|
||||
import {
|
||||
checkIframeToken,
|
||||
|
@ -517,7 +517,9 @@ function* searchSetTabSaga() {
|
|||
yield call(searchSetSaga);
|
||||
}
|
||||
|
||||
function* setSaveSuccessSaga({ address, title, is_public }: ReturnType<typeof ActionCreators.setSaveSuccess>) {
|
||||
function* setSaveSuccessSaga({
|
||||
address, title, is_public
|
||||
}: ReturnType<typeof ActionCreators.setSaveSuccess>) {
|
||||
const { id } = yield select(getUser);
|
||||
const { dialog_active } = yield select(getState);
|
||||
|
||||
|
@ -537,7 +539,7 @@ function* setSaveSuccessSaga({ address, title, is_public }: ReturnType<typeof Ac
|
|||
return yield editor.setInitialData();
|
||||
}
|
||||
|
||||
function* userLogoutSaga() {
|
||||
function* userLogoutSaga():SagaIterator {
|
||||
yield put(setUser(DEFAULT_USER));
|
||||
yield call(generateGuestSaga);
|
||||
}
|
||||
|
@ -550,6 +552,12 @@ function* setUserSaga() {
|
|||
return true;
|
||||
}
|
||||
|
||||
function* setTitleSaga({ title }: ReturnType<typeof ActionCreators.setTitle>):SagaIterator {
|
||||
if (title) {
|
||||
document.title = `${title} | Редактор маршрутов`;
|
||||
}
|
||||
}
|
||||
|
||||
export function* userSaga() {
|
||||
yield takeLatest(REHYDRATE, authCheckSaga);
|
||||
yield takeEvery(ACTIONS.SET_MODE, setModeSaga);
|
||||
|
@ -583,6 +591,8 @@ export function* userSaga() {
|
|||
|
||||
// yield takeLatest(ACTIONS.IFRAME_LOGIN_VK, iframeLoginVkSaga);
|
||||
|
||||
yield takeLatest(ACTIONS.SET_TITLE, setTitleSaga);
|
||||
|
||||
yield takeLatest([
|
||||
ACTIONS.SEARCH_SET_TITLE,
|
||||
ACTIONS.SEARCH_SET_DISTANCE,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue