mirror of
https://github.com/LuanRT/YouTube.js.git
synced 2026-06-25 07:42:11 +00:00
fix: Handle CommandExecutorCommand in NavigationEndpoint.call (#968)
Co-authored-by: Luan <luan.lrt4@gmail.com>
This commit is contained in:
@@ -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 });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user