diff --git a/backend/routes/route/post.js b/backend/routes/route/post.js index 54fb274..94e0704 100644 --- a/backend/routes/route/post.js +++ b/backend/routes/route/post.js @@ -15,8 +15,7 @@ module.exports = async (req, res) => { const logo = parseString(body.logo, 16); const provider = parseString(body.provider, 16) || 'DEFAULT'; const distance = parseNumber(body.distance, 0, 1000); - - console.log('SAVING PROVIDER?', provider, body.provider); + const is_public = !!body.is_public; if ((!route || route.length <= 0) && (!stickers || stickers.length <= 0)) { return res.send({ success: false, mode: 'empty' }); @@ -29,23 +28,23 @@ module.exports = async (req, res) => { if (exists) { exists.set({ - title, route, stickers, logo, distance, updated_at: Date.now(), provider, + title, route, stickers, logo, distance, updated_at: Date.now(), provider, is_public, }).save(); return res.send({ - success: true, title, address, route, stickers, mode: 'overwrited' + success: true, title, address, route, stickers, mode: 'overwrited', is_public, }); } const created = await Route.create({ - _id: address, title, route, stickers, owner, logo, distance, provider, + _id: address, title, route, stickers, owner, logo, distance, provider, is_public, }); await owner.routes.push(created); await owner.save(); return res.send({ - success: true, title, address, route, stickers, provider, + success: true, title, address, route, stickers, provider, is_public, }); }; diff --git a/src/components/dialogs/SaveDialog.jsx b/src/components/dialogs/SaveDialog.jsx index 121b9b5..39cb060 100644 --- a/src/components/dialogs/SaveDialog.jsx +++ b/src/components/dialogs/SaveDialog.jsx @@ -134,7 +134,7 @@ export class SaveDialog extends React.Component {
Скопировать
} { save_finished && -
Отлично, спасибо!
+
Отлично!
} diff --git a/src/redux/user/sagas.js b/src/redux/user/sagas.js index 974b0a1..9428344 100644 --- a/src/redux/user/sagas.js +++ b/src/redux/user/sagas.js @@ -17,7 +17,7 @@ import { setSaveError, setSaveOverwrite, setSaveSuccess, setTitle, searchSetTab, - setUser, setDialog, + setUser, setDialog, setPublic, } from '$redux/user/actions'; import { getUrlData, parseQuery, pushLoaderState, pushNetworkInitError, pushPath, replacePath } from '$utils/history'; import { editor } from '$modules/Editor'; @@ -277,7 +277,7 @@ function* sendSaveRequestSaga({ title, address, force, is_public }) { if (result && result.mode === 'exists') return yield put(setSaveError(TIPS.SAVE_EXISTS)); if (timeout || !result || !result.success || !result.address) return yield put(setSaveError(TIPS.SAVE_TIMED_OUT)); - return yield put(setSaveSuccess({ address: result.address, save_error: TIPS.SAVE_SUCCESS, title })); + return yield put(setSaveSuccess({ address: result.address, save_error: TIPS.SAVE_SUCCESS, title, is_public: result.is_public })); } // function* refreshUserData() { @@ -478,7 +478,7 @@ function* searchSetTabSaga() { yield call(searchSetSaga); } -function* setSaveSuccessSaga({ address, title }) { +function* setSaveSuccessSaga({ address, title, is_public }) { const { id } = yield select(getUser); const { dialog_active } = yield select(getState); @@ -486,6 +486,7 @@ function* setSaveSuccessSaga({ address, title }) { yield put(setTitle(title)); yield put(setAddress(address)); + yield put(setPublic(is_public)); yield put(setChanged(false)); yield editor.owner = { id }; diff --git a/src/sprites/icon.svg b/src/sprites/icon.svg index e25dacc..604873a 100644 --- a/src/sprites/icon.svg +++ b/src/sprites/icon.svg @@ -359,6 +359,11 @@ + + + + + @@ -370,5 +375,5 @@ - + diff --git a/src/utils/api.js b/src/utils/api.js index 93b58c6..58cf1bb 100644 --- a/src/utils/api.js +++ b/src/utils/api.js @@ -20,7 +20,7 @@ export const getStoredMap = ({ name }) => axios.get(API.GET_MAP, { }).then(result => (result && result.data && result.data.success && result.data)); export const postMap = ({ - title, address, route, stickers, id, token, force, logo, distance, provider, + title, address, route, stickers, id, token, force, logo, distance, provider, is_public, }) => axios.post(API.POST_MAP, { title, address, @@ -32,6 +32,7 @@ export const postMap = ({ logo, distance, provider, + is_public, }).then(result => (result && result.data && result.data)); export const checkIframeToken = ({ viewer_id, auth_key }) => axios.get(API.IFRAME_LOGIN_VK, {