u
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
import { matchPath } from 'react-router-dom';
|
||||
|
||||
export const ARTICLE_TAB = {
|
||||
history: 'history',
|
||||
supplier: 'supplier',
|
||||
@@ -84,6 +86,12 @@ export function resolveArticleTab(tabParam, article) {
|
||||
return preferredArticleTab(article);
|
||||
}
|
||||
|
||||
/** Tab segment from an article-detail pathname, or undefined. */
|
||||
export function articleTabFromPathname(pathname) {
|
||||
const match = matchPath('/artikel/:sku/:tab?', pathname);
|
||||
return match?.params?.tab;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param {object|string} articleOrSku
|
||||
* @param {string} [tab] omitted → preferred default from localStorage
|
||||
|
||||
@@ -61,9 +61,9 @@ class ArtikelSkuPage extends Component {
|
||||
}
|
||||
|
||||
render() {
|
||||
const { sku, tab } = this.props;
|
||||
const { sku } = this.props;
|
||||
if (!this.state.ready) return null;
|
||||
return <ArticleView sku={sku} tab={tab} />;
|
||||
return <ArticleView sku={sku} />;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user