fix(sync): historique/WL via youtubei.js authentifié + erreurs détaillées
This commit is contained in:
@@ -145,6 +145,7 @@
|
||||
</div>
|
||||
<div *ngIf="wlError()" class="mt-2 rounded-lg border border-red-700 bg-red-900/30 p-2 text-xs text-red-200">{{ wlError() }}</div>
|
||||
<div *ngIf="wlNote()" class="mt-2 rounded-lg border border-blue-700 bg-blue-900/20 p-2 text-xs text-blue-200">{{ wlNote() }}</div>
|
||||
<div *ngIf="wlLoaded() && !wlLoading() && !wlItems().length && !wlError()" class="mt-2 text-sm text-slate-400">Liste vide : aucune vidéo dans « Regarder plus tard » YouTube.</div>
|
||||
<div *ngIf="wlItems().length" class="mt-2 text-sm text-slate-300">
|
||||
{{ wlItems().length }} vidéo(s) dans « Regarder plus tard » YouTube.
|
||||
<span *ngIf="!wlWriteGranted()" class="text-amber-200">Écriture non autorisée : déconnectez puis reconnectez Google pour l’activer.</span>
|
||||
|
||||
@@ -158,7 +158,8 @@ export class ImportComponent implements OnInit {
|
||||
const code = e?.error?.error || e?.message || 'ythistory_fetch_failed';
|
||||
const hint = e?.error?.hint;
|
||||
const ytReason = e?.error?.ytReason;
|
||||
const extra = [hint, ytReason ? `YouTube: ${ytReason}` : ''].filter(Boolean).join(' — ');
|
||||
const detail = e?.error?.detail;
|
||||
const extra = [hint, ytReason ? `YouTube: ${ytReason}` : '', detail || ''].filter(Boolean).join(' — ');
|
||||
this.ytAutoError.set(extra ? `${code} — ${extra}` : code);
|
||||
} finally {
|
||||
this.ytAutoLoading.set(false);
|
||||
@@ -230,6 +231,7 @@ export class ImportComponent implements OnInit {
|
||||
wlItems = signal<Array<{ videoId: string; title: string; thumbnail?: string }>>([]);
|
||||
wlNote = signal<string | null>(null);
|
||||
wlLoading = signal(false);
|
||||
wlLoaded = signal(false);
|
||||
wlWriteGranted = signal(false);
|
||||
wlError = signal<string | null>(null);
|
||||
wlImporting = signal(false);
|
||||
@@ -242,20 +244,24 @@ export class ImportComponent implements OnInit {
|
||||
loadWatchLater(): void {
|
||||
this.wlLoading.set(true);
|
||||
this.wlError.set(null);
|
||||
this.wlLoaded.set(false);
|
||||
this.api.watchLater().subscribe({
|
||||
next: (res) => {
|
||||
this.wlItems.set(res?.items || []);
|
||||
this.wlWriteGranted.set(!!res?.writeGranted);
|
||||
this.wlNote.set(res?.note || (res?.via === 'innertube' ? 'Liste lue via InnerTube.' : null));
|
||||
this.wlLoading.set(false);
|
||||
this.wlLoaded.set(true);
|
||||
},
|
||||
error: (e) => {
|
||||
const code = e?.error?.error || e?.message || 'watchlater_fetch_failed';
|
||||
const hint = e?.error?.hint;
|
||||
const ytReason = e?.error?.ytReason;
|
||||
const extra = [hint, ytReason ? `YouTube: ${ytReason}` : ''].filter(Boolean).join(' — ');
|
||||
const detail = e?.error?.detail;
|
||||
const extra = [hint, ytReason ? `YouTube: ${ytReason}` : '', detail || ''].filter(Boolean).join(' — ');
|
||||
this.wlError.set(extra ? `${code} — ${extra}` : code);
|
||||
this.wlLoading.set(false);
|
||||
this.wlLoaded.set(true);
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user