feat(NavigationEndpoint): parse content prop

This usually has dialog nodes.
This commit is contained in:
LuanRT
2023-04-29 01:54:34 -03:00
parent 3a7e58d2b9
commit dd21f8c75a
2 changed files with 6 additions and 7 deletions

View File

@@ -1,6 +1,6 @@
import type Actions from '../../core/Actions.js';
import type { ApiResponse } from '../../core/Actions.js';
import { type SuperParsedResult, YTNode } from '../helpers.js';
import { YTNode } from '../helpers.js';
import Parser, { type RawNode } from '../index.js';
import type { IParsedResponse } from '../types/ParsedResponse.js';
import CreatePlaylistDialog from './CreatePlaylistDialog.js';
@@ -9,7 +9,7 @@ export default class NavigationEndpoint extends YTNode {
static type = 'NavigationEndpoint';
payload;
dialog?: CreatePlaylistDialog | SuperParsedResult<YTNode> | null;
dialog?: CreatePlaylistDialog | YTNode | null;
metadata: {
url?: string;
@@ -32,8 +32,8 @@ export default class NavigationEndpoint extends YTNode {
this.payload = name ? Reflect.get(data, name) : {};
if (Reflect.has(this.payload, 'dialog')) {
this.dialog = Parser.parse(this.payload.dialog);
if (Reflect.has(this.payload, 'dialog') || Reflect.has(this.payload, 'content')) {
this.dialog = Parser.parseItem(this.payload.dialog || this.payload.content);
}
if (data?.serviceEndpoint) {