{"action":"created","issue":{"url":"https://api.github.com/repos/mjackson/history/issues/279","repository_url":"https://api.github.com/repos/mjackson/history","labels_url":"https://api.github.com/repos/mjackson/history/issues/279/labels{/name}","comments_url":"https://api.github.com/repos/mjackson/history/issues/279/comments","events_url":"https://api.github.com/repos/mjackson/history/issues/279/events","html_url":"https://github.com/mjackson/history/issues/279","id":150606312,"number":279,"title":"Support for custom addBasename in useBasename ","user":{"login":"marcelalburg","id":4396769,"avatar_url":"https://avatars.githubusercontent.com/u/4396769?v=3","gravatar_id":"","url":"https://api.github.com/users/marcelalburg","html_url":"https://github.com/marcelalburg","followers_url":"https://api.github.com/users/marcelalburg/followers","following_url":"https://api.github.com/users/marcelalburg/following{/other_user}","gists_url":"https://api.github.com/users/marcelalburg/gists{/gist_id}","starred_url":"https://api.github.com/users/marcelalburg/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/marcelalburg/subscriptions","organizations_url":"https://api.github.com/users/marcelalburg/orgs","repos_url":"https://api.github.com/users/marcelalburg/repos","events_url":"https://api.github.com/users/marcelalburg/events{/privacy}","received_events_url":"https://api.github.com/users/marcelalburg/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2016-04-23T23:05:28Z","updated_at":"2016-04-24T01:35:46Z","closed_at":"2016-04-24T01:35:22Z","body":"Hello,\r\n\r\ni use the feature addBasename in my project and it works super. now, i need a possibility to write some custom code in addBasename.\r\n\r\nwhen the customer goes to my project, he see the startpage / (in my JS, i defined \"/de\" as basepath dynamically). After one click, the customer see in the url path /de/site and with the click on the logo (home link), the page is /de/.\r\n\r\ni want change just the home link that this one stays / instead of /de\r\n\r\na possibility is to allow a custom function in addBasename.\r\n\r\ncurrently, i add\r\n\r\n      if (!location || location == '/')\r\n        return '/'\r\n\r\nto prependBasename in https://github.com/mjackson/history/blob/master/modules/useBasename.js and it works for me\r\n\r\n\r\nThanks\r\nMarcel\r\n\r\n\r\nfull code of prependBasename:\r\n\r\n    const prependBasename = (location) => {\r\n      if (!basename)\r\n        return location\r\n\r\n      if (!location || location == '/')\r\n        return '/'\r\n\r\n      const object = typeof location === 'string' ? parsePath(location) : location\r\n      const pname = object.pathname\r\n      const normalizedBasename = basename.slice(-1) === '/' ? basename : `${basename}/`\r\n      const normalizedPathname = pname.charAt(0) === '/' ? pname.slice(1) : pname\r\n      const pathname = normalizedBasename + normalizedPathname\r\n\r\n      return {\r\n        ...location,\r\n        pathname\r\n      }\r\n    }\r\n"},"comment":{"url":"https://api.github.com/repos/mjackson/history/issues/comments/213863930","html_url":"https://github.com/mjackson/history/issues/279#issuecomment-213863930","issue_url":"https://api.github.com/repos/mjackson/history/issues/279","id":213863930,"user":{"login":"taion","id":3112159,"avatar_url":"https://avatars.githubusercontent.com/u/3112159?v=3","gravatar_id":"","url":"https://api.github.com/users/taion","html_url":"https://github.com/taion","followers_url":"https://api.github.com/users/taion/followers","following_url":"https://api.github.com/users/taion/following{/other_user}","gists_url":"https://api.github.com/users/taion/gists{/gist_id}","starred_url":"https://api.github.com/users/taion/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/taion/subscriptions","organizations_url":"https://api.github.com/users/taion/orgs","repos_url":"https://api.github.com/users/taion/repos","events_url":"https://api.github.com/users/taion/events{/privacy}","received_events_url":"https://api.github.com/users/taion/received_events","type":"User","site_admin":false},"created_at":"2016-04-24T01:35:45Z","updated_at":"2016-04-24T01:35:45Z","body":"What I mean is – your basename is actually empty, and it's more like you have some routes under `/de`."}}