From 8391408bb340519646c522476885ef7ca848fab1 Mon Sep 17 00:00:00 2001 From: muerwre Date: Thu, 14 Feb 2019 09:44:10 +0700 Subject: [PATCH] document title changes on route load --- backend/tools/import.js | 2 +- src/modules/Sticker.js | 2 -- src/redux/user/sagas.ts | 16 +++++++++++++--- 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/backend/tools/import.js b/backend/tools/import.js index 0481cc3..ee19d5a 100755 --- a/backend/tools/import.js +++ b/backend/tools/import.js @@ -141,7 +141,7 @@ const run = async () => { title: '', version: 1, distance: calcPolyDistance(route), - is_public: true, + is_public: false, }; })); })); diff --git a/src/modules/Sticker.js b/src/modules/Sticker.js index e184e09..012d3df 100644 --- a/src/modules/Sticker.js +++ b/src/modules/Sticker.js @@ -131,8 +131,6 @@ export class Sticker { window.removeEventListener('touchend', this.onDragStop); this.lockMapClicks(false); - - // this.marker.enableEdit(); }; onDrag = e => { diff --git a/src/redux/user/sagas.ts b/src/redux/user/sagas.ts index f4a19c6..cc35ea8 100644 --- a/src/redux/user/sagas.ts +++ b/src/redux/user/sagas.ts @@ -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) { +function* setSaveSuccessSaga({ + address, title, is_public +}: ReturnType) { const { id } = yield select(getUser); const { dialog_active } = yield select(getState); @@ -537,7 +539,7 @@ function* setSaveSuccessSaga({ address, title, is_public }: ReturnType):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,