document title changes on route load

This commit is contained in:
muerwre 2019-02-14 09:44:10 +07:00
parent a04b903206
commit 8391408bb3
3 changed files with 14 additions and 6 deletions

View file

@ -141,7 +141,7 @@ const run = async () => {
title: '',
version: 1,
distance: calcPolyDistance(route),
is_public: true,
is_public: false,
};
}));
}));

View file

@ -131,8 +131,6 @@ export class Sticker {
window.removeEventListener('touchend', this.onDragStop);
this.lockMapClicks(false);
// this.marker.enableEdit();
};
onDrag = e => {

View file

@ -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,