I am working on SharePoint Online. Inside the 'Site Pages' library, I have created a few site Pages and I also create a 'Link' item using the New > Links option. I use the 'Link' to connect to a page in SharePoint. After the link item is created, the Name of the Link is 'sample.Url'. When I click on the link from SharePoint, it takes me to the page associated with the link.
My issue is that, I try to get the items in Site Pages library using Rest API and display as a tree view in my SPFx web part. But inside the web part, if I click on the link, it just download the page.
Can any one help to resolve the issue. Is there any way I can use REST API to get the actual URL I gave in SharePoint while creating the field?
This is the API I used to get the items
const url = subPageUrl + "/_api/web/lists/getbytitle('Site%20Pages')/items?$select=Title,FileDirRef,File_x0020_Type,EncodedAbsUrl,FileRef,FileLeafRef"