// public page code on your members page import { getMyHoldings } from 'backend/holdings'; import wixUsers from 'wix-users'; $w.onReady(async function () { // Make sure user is logged in const user = wixUsers.currentUser; if (!user.loggedIn) { // Redirect or show a message $w('#holdingsTable').hide(); $w('#statusText').text = 'Please sign in to view your holdings.'; $w('#statusText').show(); return; } $w('#statusText').text = 'Loading your holdings...'; $w('#statusText').show(); $w('#holdingsTable').hide(); try { const rows = await getMyHoldings(); // If you used a Table: $w('#holdingsTable').rows = rows; // rows must be array of plain objects $w('#holdingsTable').show(); $w('#statusText').hide(); // If you used a Repeater instead: // $w('#repeater').data = rows; // $w('#repeater').onItemReady(($item, itemData) => { // $item('#asset').text = itemData.Asset; // $item('#qty').text = String(itemData.Qty || ''); // $item('#value').text = String(itemData.Value || ''); // // etc... // }); // $w('#repeater').show(); // $w('#statusText').hide(); } catch (err) { console.error(err); $w('#statusText').text = 'Unable to load holdings. Please try again later.'; } });
top of page
bottom of page