fix: routing issues (#590)
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));
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
import isEqual from 'lodash/isEqual';
|
||||
import { redirect } from 'react-router-dom';
|
||||
|
||||
import { currentBackend } from '../backend';
|
||||
import {
|
||||
@ -48,7 +49,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';
|
||||
@ -1040,7 +1040,7 @@ export function persistEntry(collection: Collection) {
|
||||
}
|
||||
if (entry.slug !== newSlug) {
|
||||
await dispatch(loadEntry(collection, newSlug));
|
||||
navigateToEntry(collection.name, newSlug);
|
||||
redirect(`/collections/${collection.name}/entries/${newSlug}`);
|
||||
} else {
|
||||
await dispatch(loadEntry(collection, newSlug, true));
|
||||
}
|
||||
|
Reference in New Issue
Block a user