Correction of code for file download for current item in a repeater with dataset

Hello, please I would like a correction/ explanation of the following code. I am trying to write a code for file download for current item in a repeater with dataset

BACKEND
import wixData from ‘wix-data’;
import {mediaManager} from ‘wix-media-backend’;
let score;
$w(“#myDataset”).onCurrentIndexChanged( (index) => {
let newIndex = index; // 3
} );

export async function process() {
(‘Courses’).onCurrentIndexChanged
.find()
.then(async(results) => {
if(results.items.length > 0) {
score = results.items;
const myFileDownloadUrl = await mediaManager.getDownloadUrl(score[0 , 90].image);
return myFileDownloadUrl;
} else {
return{success:false};
}
});

}

PAGE CODE

import wixLocationFrontend from ‘wix-location’;
import { process } from ‘backend/media’;

export function MoreButton_click(event) {
process()
.then((myFileDownloadUrl) => {
wixLocationFrontend.to(myFileDownloadUrl)
}

    )

}

It seems you are trying to use the Dataset API in your backend file. You can only use this API in your site’s frontend code (page code).

One approach to implement this feature is to get the Wix Media URL from the dataset object in the page code and pass it to your backend function that calls getDownloadURL().

This backend function is also a good place to validate the request and make sure the user is authorized to download the associated file.