mirror of
https://github.com/muerwre/orchidmap-front.git
synced 2025-04-25 11:06:40 +07:00
complete setting and editing description
This commit is contained in:
parent
c040e33a8a
commit
8f60a5efd6
10 changed files with 118 additions and 91 deletions
|
@ -5,10 +5,10 @@ import { IRootState } from "$redux/user/reducer";
|
|||
export const setUser = (user: IUser) => ({ type: ACTIONS.SET_USER, user });
|
||||
export const userLogout = () => ({ type: ACTIONS.USER_LOGOUT });
|
||||
|
||||
export const setEditing = editing => ({ type: ACTIONS.SET_EDITING, editing });
|
||||
export const setMode = mode => ({ type: ACTIONS.SET_MODE, mode });
|
||||
export const setDistance = distance => ({ type: ACTIONS.SET_DISTANCE, distance });
|
||||
export const setChanged = changed => ({ type: ACTIONS.SET_CHANGED, changed });
|
||||
export const setEditing = (editing: IRootState['editing']) => ({ type: ACTIONS.SET_EDITING, editing });
|
||||
export const setMode = (mode: IRootState['mode']) => ({ type: ACTIONS.SET_MODE, mode });
|
||||
export const setDistance = (distance: IRootState['distance']) => ({ type: ACTIONS.SET_DISTANCE, distance });
|
||||
export const setChanged = (changed: IRootState['changed']) => ({ type: ACTIONS.SET_CHANGED, changed });
|
||||
export const setRouterPoints = routerPoints => ({ type: ACTIONS.SET_ROUTER_POINTS, routerPoints });
|
||||
export const setActiveSticker = activeSticker => ({ type: ACTIONS.SET_ACTIVE_STICKER, activeSticker });
|
||||
export const setLogo = logo => ({ type: ACTIONS.SET_LOGO, logo });
|
||||
|
@ -44,9 +44,18 @@ export const sendSaveRequest = (payload: {
|
|||
|
||||
export const resetSaveDialog = () => ({ type: ACTIONS.RESET_SAVE_DIALOG });
|
||||
|
||||
export const setSaveLoading = save_loading => ({ type: ACTIONS.SET_SAVE_LOADING, save_loading });
|
||||
export const setSaveSuccess = payload => ({ type: ACTIONS.SET_SAVE_SUCCESS, ...payload });
|
||||
export const setSaveError = save_error => ({ type: ACTIONS.SET_SAVE_ERROR, save_error });
|
||||
export const setSaveLoading = (save_loading: IRootState['save_loading']) => ({ type: ACTIONS.SET_SAVE_LOADING, save_loading });
|
||||
|
||||
export const setSaveSuccess = (payload: {
|
||||
address: IRootState['address'],
|
||||
title: IRootState['address'],
|
||||
is_public: IRootState['is_public'],
|
||||
description: IRootState['description'],
|
||||
|
||||
save_error: string,
|
||||
}) => ({ type: ACTIONS.SET_SAVE_SUCCESS, ...payload });
|
||||
|
||||
export const setSaveError = (save_error: IRootState['save_error']) => ({ type: ACTIONS.SET_SAVE_ERROR, save_error });
|
||||
export const setSaveOverwrite = () => ({ type: ACTIONS.SET_SAVE_OVERWRITE });
|
||||
|
||||
export const hideRenderer = () => ({ type: ACTIONS.HIDE_RENDERER });
|
||||
|
|
|
@ -179,7 +179,11 @@ const setSaveOverwrite: ActionHandler<typeof ActionCreators.setSaveOverwrite> =
|
|||
});
|
||||
|
||||
const setSaveSuccess: ActionHandler<typeof ActionCreators.setSaveSuccess> = (state, { save_error }) => ({
|
||||
...state, save_overwriting: false, save_finished: true, save_processing: false, save_error
|
||||
...state,
|
||||
save_overwriting: false,
|
||||
save_finished: true,
|
||||
save_processing: false,
|
||||
save_error,
|
||||
});
|
||||
|
||||
const resetSaveDialog: ActionHandler<typeof ActionCreators.resetSaveDialog> = (state) => ({
|
||||
|
|
|
@ -32,7 +32,7 @@ import {
|
|||
setProvider,
|
||||
changeProvider,
|
||||
setSaveLoading,
|
||||
mapsSetShift, searchChangeDistance, clearAll, setFeature, searchSetTitle, setRouteStarred,
|
||||
mapsSetShift, searchChangeDistance, clearAll, setFeature, searchSetTitle, setRouteStarred, setDescription,
|
||||
} from '$redux/user/actions';
|
||||
import { getUrlData, parseQuery, pushLoaderState, pushNetworkInitError, pushPath, replacePath } from '$utils/history';
|
||||
import { editor } from '$modules/Editor';
|
||||
|
@ -333,17 +333,15 @@ function* sendSaveRequestSaga({
|
|||
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, is_public: result.is_public
|
||||
address: result.address,
|
||||
title: result.title,
|
||||
is_public: result.is_public,
|
||||
description: result.description,
|
||||
|
||||
save_error: TIPS.SAVE_SUCCESS,
|
||||
}));
|
||||
}
|
||||
|
||||
// function* refreshUserData() {
|
||||
// const user = yield select(getUser);
|
||||
// const data = yield call(checkUserToken, user);
|
||||
//
|
||||
// return yield put(setUser(data));
|
||||
// }
|
||||
|
||||
function* getRenderData() {
|
||||
yield put(setRenderer({ info: 'Загрузка тайлов', progress: 0.1 }));
|
||||
|
||||
|
@ -570,7 +568,7 @@ function* searchSetTabSaga() {
|
|||
}
|
||||
|
||||
function* setSaveSuccessSaga({
|
||||
address, title, is_public
|
||||
address, title, is_public, description,
|
||||
}: ReturnType<typeof ActionCreators.setSaveSuccess>) {
|
||||
const { id } = yield select(getUser);
|
||||
const { dialog_active } = yield select(getState);
|
||||
|
@ -580,6 +578,7 @@ function* setSaveSuccessSaga({
|
|||
yield put(setTitle(title));
|
||||
yield put(setAddress(address));
|
||||
yield put(setPublic(is_public));
|
||||
yield put(setDescription(description));
|
||||
yield put(setChanged(false));
|
||||
|
||||
yield editor.owner = { id };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue