Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions src/adminjs-options.interface.ts
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,10 @@ export interface AdminJSOptions {
* url to a login page, default to `/admin/login`
*/
loginPath?: string;
/**
* url to refresh the token, default to `/admin/refresh-token`
*/
refreshTokenPath?: string;
/**
* Array of all Databases which are supported by AdminJS via adapters
*/
Expand Down
18 changes: 16 additions & 2 deletions src/frontend/store/initialize-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,24 @@ export const initializeStore = async (
store.dispatch(initializeAssets(assets || {}))
if (theme) store.dispatch(initializeTheme(theme))

const { loginPath, logoutPath, rootPath, dashboard, pages, assetsCDN } = admin.options
const {
loginPath,
logoutPath,
refreshTokenPath,
rootPath,
dashboard,
pages,
assetsCDN
} = admin.options

store.dispatch(initializePages(pagesToStore(pages)))
store.dispatch(initializePaths({ loginPath, logoutPath, rootPath, assetsCDN }))
store.dispatch(initializePaths({
loginPath,
logoutPath,
refreshTokenPath,
rootPath,
assetsCDN
}))
store.dispatch(setCurrentAdmin(currentAdmin))
store.dispatch(initializeDashboard(dashboard))
store.dispatch(
Expand Down
2 changes: 1 addition & 1 deletion src/frontend/utils/api-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ class ApiClient {

async refreshToken(data: Record<string, any>) {
const response = await this.client.request({
url: '/refresh-token',
url: globalAny.REDUX_STATE.paths.refreshTokenPath,
method: 'POST',
data,
})
Expand Down