fix(ui): basePath not handled for logout route (#6817)
## Description Fixes an issue where if you define a `basePath` in your `next` config, the logout button would redirect you to `/admin/logout` instead of `/basePath/admin/logout` causing a 404. - [x] I have read and understand the [CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md) document in this repository. ## Type of change - [x] Bug fix (non-breaking change which fixes an issue) ## Checklist: - [x] Existing test suite passes locally with my changes
This commit is contained in:
@@ -22,13 +22,15 @@ const DefaultLogout: React.FC<{
|
||||
routes: { admin },
|
||||
} = config
|
||||
|
||||
const basePath = process.env.NEXT_BASE_PATH ?? ''
|
||||
|
||||
const LinkElement = Link || 'a'
|
||||
|
||||
return (
|
||||
<LinkElement
|
||||
aria-label={t('authentication:logOut')}
|
||||
className={`${baseClass}__log-out`}
|
||||
href={`${admin}${logoutRoute}`}
|
||||
href={`${basePath}${admin}${logoutRoute}`}
|
||||
tabIndex={tabIndex}
|
||||
>
|
||||
<LogOutIcon />
|
||||
|
||||
Reference in New Issue
Block a user