Merge branch 'main' into next
This commit is contained in:
@ -1,18 +0,0 @@
|
||||
import { history } from '../routing/history';
|
||||
import { getCollectionUrl, getNewEntryUrl } from '../lib/urlHelper';
|
||||
|
||||
export function searchCollections(query: string, collection?: string) {
|
||||
if (collection) {
|
||||
history.push(`/collections/${collection}/search/${query}`);
|
||||
} else {
|
||||
history.push(`/search/${query}`);
|
||||
}
|
||||
}
|
||||
|
||||
export function showCollection(collectionName: string) {
|
||||
history.push(getCollectionUrl(collectionName));
|
||||
}
|
||||
|
||||
export function createNewEntry(collectionName: string) {
|
||||
history.push(getNewEntryUrl(collectionName));
|
||||
}
|
@ -48,7 +48,6 @@ import {
|
||||
selectIsFetching,
|
||||
selectPublishedSlugs,
|
||||
} from '../reducers/selectors/entries';
|
||||
import { navigateToEntry } from '../routing/history';
|
||||
import { addSnackbar } from '../store/slices/snackbars';
|
||||
import { createAssetProxy } from '../valueObjects/AssetProxy';
|
||||
import createEntry from '../valueObjects/createEntry';
|
||||
@ -56,6 +55,7 @@ import { addAssets, getAsset } from './media';
|
||||
import { loadMedia, waitForMediaLibraryToLoad } from './mediaLibrary';
|
||||
import { waitUntil } from './waitUntil';
|
||||
|
||||
import type { NavigateFunction } from 'react-router-dom';
|
||||
import type { AnyAction } from 'redux';
|
||||
import type { ThunkDispatch } from 'redux-thunk';
|
||||
import type { Backend } from '../backend';
|
||||
@ -950,7 +950,7 @@ export function getSerializedEntry(collection: Collection, entry: Entry): Entry
|
||||
return serializedEntry;
|
||||
}
|
||||
|
||||
export function persistEntry(collection: Collection) {
|
||||
export function persistEntry(collection: Collection, navigate: NavigateFunction) {
|
||||
return async (dispatch: ThunkDispatch<RootState, {}, AnyAction>, getState: () => RootState) => {
|
||||
const state = getState();
|
||||
const entryDraft = state.entryDraft;
|
||||
@ -1039,7 +1039,7 @@ export function persistEntry(collection: Collection) {
|
||||
}
|
||||
if (entry.slug !== newSlug) {
|
||||
await dispatch(loadEntry(collection, newSlug));
|
||||
navigateToEntry(collection.name, newSlug);
|
||||
navigate(`/collections/${collection.name}/entries/${newSlug}`);
|
||||
} else {
|
||||
await dispatch(loadEntry(collection, newSlug, true));
|
||||
}
|
||||
|
Reference in New Issue
Block a user