diff --git a/core/src/components/friends-view/friends-feed.js b/core/src/components/friends-view/friends-feed.js new file mode 100644 index 00000000..a20d1733 --- /dev/null +++ b/core/src/components/friends-view/friends-feed.js @@ -0,0 +1,244 @@ +import { LitElement, html, css } from 'lit'; +import '@material/mwc-icon'; +import './friends-view' +import { friendsViewStyles } from './friends-view-css'; +import { connect } from 'pwa-helpers'; +import { store } from '../../store'; +class FriendsFeed extends connect(store)(LitElement) { + static get properties() { + return { + feed: {type: Array} + }; + } + constructor(){ + super() + this.feed = [] + this.nodeUrl = this.getNodeUrl(); + this.myNode = this.getMyNode(); + } + + static get styles() { + return [friendsViewStyles]; + } + + getNodeUrl() { + const myNode = + store.getState().app.nodeConfig.knownNodes[ + window.parent.reduxStore.getState().app.nodeConfig.node + ]; + + const nodeUrl = + myNode.protocol + '://' + myNode.domain + ':' + myNode.port; + return nodeUrl; + } + getMyNode() { + const myNode = + store.getState().app.nodeConfig.knownNodes[ + window.parent.reduxStore.getState().app.nodeConfig.node + ]; + + return myNode; + } + + async firstUpdated(){ + console.log('sup') + const feedData = schema.feed[0] + let schemaObj = {...schema} + const dynamicVars = { + name: 'Phil' + } + const getMail = async () => { + + const baseurl = `${this.nodeUrl}/arbitrary/resources/search?reverse=true` + const fullUrl = constructUrl(baseurl, feedData.search, dynamicVars); + console.log({fullUrl}) + const response = await fetch(fullUrl, { + method: 'GET', + headers: { + 'Content-Type': 'application/json' + } + }) + + const data = await response.json() + return data; + } + try { + getMail() + const resource = { + name: 'Phil', + identifier: 'q-blog-Mugician-post-Love-Explosion-Festival--yJ8kuo' + } + // First, evaluate methods to get values for customParams +await updateCustomParamsWithMethods(schemaObj, resource); +console.log({schemaObj}) +// Now, generate your final URLs +let clickValue1 = schemaObj.feed[0].click; + +const resolvedClickValue1 = replacePlaceholders(clickValue1, resource, schemaObj.feed[0].customParams); + +console.log(resolvedClickValue1); + + } catch (error) { + console.log(error) + } + } + + render() { + console.log('ron') + return html` +
hello
`; + })} + +