Wishlist for Shop

Hi. I’m trying to build a wishlist where you can add items. The problem is, that you could add an item multiple times, since there’s no code preventing that. I want to change the button to “already in wishlist” or something similar.

First it should check if the item is already in the database. If it is, the button “addToWishlist” should disappear and the “inWishlist” button should show up. However this doesn’t work. Instead it always says that the item is already in my wishlist and then too, I can’t remove the item from my wishlist.
Please help me. Thanks in advance.

So this is my code:

import wixUsers from 'wix-users';
import wixData from 'wix-data';
import wixLocation from 'wix-location'; 

$w.onReady(function () { 
 if (($w("#itemdetails").setFilter(wixData.filter().contains("myList", { Id: $w('#itemdetails').getCurrentItem()._id })))) { 
        $w('#addToWishlist').hide() 
        $w('#inWishlist').show() 
    } else {
        $w('#addToWishlist').show() 
        $w('#inWishlist').hide() 
    }
})

export function addToWishlist() {
    wixData.insert('myList', { Id: $w('#itemdetails').getCurrentItem()._id }),
        $w('#addToWishlist').hide(),
        $w('#inWishlist').show(); 
}

export function inWishlist() {
    wixData.remove('myList', { movieId: $w('#itemdetails').getCurrentItem()._id }),
        $w('#addToWishlist').show(), 
        $w('#inWishlist').hide();
}

Wix already do a wishlist tutorial shown here.
https://www.wix.com/corvid/example/wishlist
https://support.wix.com/en/article/corvid-adding-a-wishlist-to-a-wix-stores-site

Also, Nayeli (Code Queen) has also done a wishlist tutorial shown here.
https://www.youtube.com/watch?v=PLl4sqYTitA - part 1
https://www.youtube.com/watch?v=6fx55HHSGNk - part 2

Thanks a lot for your fast reply. The tutorial (first link) worked perfectly for me. Thanks again!