Filtering Customer Orders And Displaying Through Repeater

Hey! I have created a page on my website where customers can check their past orders (I want to customise the orders page and hence wanting to make my own since Wix does not allow you to customise theirs).

Essentially, I have created a repeater and linked all the relevant information I want to show on to the page. I was advised to do the following in order for my idea to work:
1) Get the email of currently logged-in user;
2) Use the email sub-field under buyer info field of the Orders’ collection to filter your items

I am not sure whether I am missing something in the code or if my idea of linking fields on the repeater to the Orders dataset and writing this code would show what I want to show!

If someone could help me out, I would appreciate it heaps!


This is the code I have attempted to use to do so.

import wixData from 'wix-data';

import wixUsers from 'wix-users';

$w.onReady(() =>{

 let user = wixUsers.currentUser; 

 let email = user.getEmail()

         .then(() => {

 let userEmail = email;

           wixData.query("Stores/Orders")

            .eq("email", "userEmail")

           .find()
           .then( (results) => {
              $w("#repeater2").data = results.items;
        });
   });

});