-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1244 from dis-moi/fix/getPathToContributor
fix(profiles): getPathToContributor does not include path prefix
- Loading branch information
Showing
6 changed files
with
23 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,16 @@ | ||
import slugify from 'slugify'; | ||
import i18n from 'i18next'; | ||
import join from 'join-url'; | ||
import { Contributor } from 'libs/domain/contributor'; | ||
import { getPathPrefix } from '../../../libs/facets/getPathPrefix'; | ||
|
||
const pathToContributor = (contributor: Contributor) => { | ||
return `${i18n.t('path.profiles.contributors')}/${contributor.id}/${slugify( | ||
contributor.name | ||
)}`; | ||
return join.pathname( | ||
getPathPrefix(i18n), | ||
i18n.t('path.profiles.contributors'), | ||
contributor.id, | ||
slugify(contributor.name) | ||
); | ||
}; | ||
|
||
export default pathToContributor; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { i18n } from 'i18next'; | ||
import { getFacet } from './getFacet'; | ||
|
||
export const getPathPrefix = (i18n: i18n): string => | ||
getFacet() === 'lmel' ? '' : `/${i18n.language}`; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters