fix: Handle CommandExecutorCommand in NavigationEndpoint.call (#968)

Co-authored-by: Luan <luan.lrt4@gmail.com>
This commit is contained in:
absidue
2025-06-08 12:12:26 +02:00
committed by GitHub
parent 11c419a96c
commit 698121ab8f

View File

@@ -2,6 +2,7 @@ import { YTNode } from '../helpers.js';
import { Parser, type IEndpoint, type RawNode } from '../index.js';
import OpenPopupAction from './actions/OpenPopupAction.js';
import CreatePlaylistDialog from './CreatePlaylistDialog.js';
import CommandExecutorCommand from './commands/CommandExecutorCommand.js';
import type Actions from '../../core/Actions.js';
import type ModalWithTitleAndButton from './ModalWithTitleAndButton.js';
@@ -124,7 +125,12 @@ export default class NavigationEndpoint extends YTNode {
throw new Error('An API caller must be provided');
if (this.command) {
const command = this.command as (YTNode & IEndpoint);
let command = this.command as (YTNode & IEndpoint);
if (command.is(CommandExecutorCommand)) {
command = command.commands.at(-1) as (YTNode & IEndpoint);
}
return actions.execute(command.getApiPath(), { ...command.buildRequest(), ...args });
}