fix(Accounts): fix public playlists not updating after first set
This commit is contained in:
parent
57f4380a29
commit
0bccd4fea5
1 changed files with 5 additions and 4 deletions
|
|
@ -377,6 +377,7 @@ const syncManager = {
|
||||||
const data = {
|
const data = {
|
||||||
uuid: playlist.id,
|
uuid: playlist.id,
|
||||||
uid: uid,
|
uid: uid,
|
||||||
|
firebase_id: uid,
|
||||||
title: playlist.name,
|
title: playlist.name,
|
||||||
name: playlist.name,
|
name: playlist.name,
|
||||||
playlist_name: playlist.name,
|
playlist_name: playlist.name,
|
||||||
|
|
@ -398,9 +399,9 @@ const syncManager = {
|
||||||
});
|
});
|
||||||
|
|
||||||
if (existing.items.length > 0) {
|
if (existing.items.length > 0) {
|
||||||
await this.pb.collection(PUBLIC_COLLECTION).update(existing.items[0].id, data);
|
await this.pb.collection(PUBLIC_COLLECTION).update(existing.items[0].id, data, { f_id: uid });
|
||||||
} else {
|
} else {
|
||||||
await this.pb.collection(PUBLIC_COLLECTION).create(data);
|
await this.pb.collection(PUBLIC_COLLECTION).create(data, { f_id: uid });
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to publish playlist:', error);
|
console.error('Failed to publish playlist:', error);
|
||||||
|
|
@ -412,13 +413,13 @@ const syncManager = {
|
||||||
if (!uid) return;
|
if (!uid) return;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const existing = await this.pb.collection('public_playlists').getList(1, 1, {
|
const existing = await this.pb.collection(PUBLIC_COLLECTION).getList(1, 1, {
|
||||||
filter: `uuid="${uuid}"`,
|
filter: `uuid="${uuid}"`,
|
||||||
p_id: uuid,
|
p_id: uuid,
|
||||||
});
|
});
|
||||||
|
|
||||||
if (existing.items && existing.items.length > 0) {
|
if (existing.items && existing.items.length > 0) {
|
||||||
await this.pb.collection('public_playlists').delete(existing.items[0].id, { p_id: uuid });
|
await this.pb.collection(PUBLIC_COLLECTION).delete(existing.items[0].id, { p_id: uuid, f_id: uid });
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to unpublish playlist:', error);
|
console.error('Failed to unpublish playlist:', error);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue