You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airflow.apache.org by "pierrejeambrun (via GitHub)" <gi...@apache.org> on 2025/04/22 11:43:49 UTC
Re: [PR] Logout functionality should respect `base_url` config in `api` section [airflow]
pierrejeambrun commented on code in PR #49545:
URL: https://github.com/apache/airflow/pull/49545#discussion_r2053940492
##########
airflow-core/src/airflow/ui/src/layouts/Nav/LogoutModal.tsx:
##########
@@ -31,8 +31,12 @@ const LogoutModal: React.FC<LogoutModalProps> = ({ isOpen, onClose }) => (
<ConfirmationModal
header="Logout"
onConfirm={() => {
+ const baseHref = document.querySelector("head>base")?.getAttribute("href") ?? "";
+ const baseUrl = new URL(baseHref, globalThis.location.origin);
+ const logoutPath = new URL("api/v2/auth/logout", baseUrl).pathname;
+
localStorage.removeItem(TOKEN_STORAGE_KEY);
- globalThis.location.replace(`/api/v2/auth/logout`);
+ globalThis.location.replace(logoutPath);
Review Comment:
Nit: I think we should extract a small utility function for this piece of code. To not duplicate it from the `main.tsx` file.
Basically something like. `getRedictPath(targetPath)`. (That will read the tag and take this into account.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: commits-unsubscribe@airflow.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org