Commit fba0e137 authored by Bitcoin Please's avatar Bitcoin Please

Added profile details request.

parent 54c17489
......@@ -30,9 +30,6 @@
<meta name="twitter:title" content="Causes Cash">
<meta name="twitter:description" content="An uncensorable funding platform for radical creators and unstoppable service providers.">
<meta name="twitter:image" content="https://causes.cash/poster.jpg?1580211230">
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Roboto:100,300,400,500,700,900">
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.8.2/css/all.css">
</head>
<body>
......
/* Import modules (getters). */
import getAvatar from './profile/getters/getAvatar'
import getDetails from './profile/getters/getDetails'
import getEmail from './profile/getters/getEmail'
import getMasterSeed from './profile/getters/getMasterSeed'
import getMeta from './profile/getters/getMeta'
......@@ -68,6 +69,7 @@ const state = {
/* Getters. */
const getters = {
getAvatar,
getDetails,
getEmail,
getMasterSeed,
getMeta,
......
/* Import modules. */
import Nito from 'nitojs'
import superagent from 'superagent'
/**
* Get Details
*/
const getDetails = async (state, getter, rootState, rootGetters) => {
/* Set profile index. */
const profileIndex = 0
/* Set chain. */
const chain = 0 // receiving account
/* Set derivation path. */
const path = rootGetters['wallet/getDerivationPath'](chain, profileIndex)
/* Initialize HD node. */
const hdNode = rootGetters['wallet/getHDNode']
/* Initialize child node. */
const childNode = hdNode.deriveChild(path)
/* Set (profile) address. */
const address = Nito.Address.toCashAddress(childNode)
// console.log('GET DETAILS (address):', address)
/* Retrieve API provider. */
const API_PROVIDER = rootGetters.getApiProvider
const results = await superagent.get(`${API_PROVIDER}/profiles/${address}`)
// console.log('GET DETAILS (profile):', results)
if (results && results.body) {
return results.body[0] // FIXME: Should we ONLY send one result??
} else {
return results
}
}
/* Export module. */
export default getDetails
......@@ -27,11 +27,11 @@
</router-link>
<div class="text-center">
<router-link :to="campaign.slug + '-null'">
<router-link :to="'/@' + campaign.owner.slug + '/' + campaign.slug + '-null'">
open live
</router-link>
|
<router-link :to="campaign.slug + '/manage'">
<router-link :to="'/@' + campaign.owner.slug + '/' + campaign.slug + '/manage'">
manage
</router-link>
</div>
......@@ -138,6 +138,7 @@ export default {
]),
...mapGetters('profile', [
'getDetails',
'getSignedMessage',
]),
......@@ -207,10 +208,21 @@ export default {
},
created: async function () {
/* Set owner slug. */
this.ownerSlug = this.$route.params.pathMatch.toLowerCase()
// this.ownerSlug = this.$route.params.pathMatch.toLowerCase()
// console.log('OWNER SLUG', this.ownerSlug)
const details = await this.getDetails
console.log('GET DETAILS (campaigns)', details)
const account = details.account
console.log('ACCOUNT', account);
const address = account.address
console.log('ADDRESS', address);
/* Retrieve campaigns. */
this.campaigns = await this.getCampaigns(this.ownerSlug)
// this.campaigns = await this.getCampaigns(this.ownerSlug)
this.campaigns = await this.getCampaigns(address)
console.log('ACCOUNT CAMAPAIGNS', this.campaigns)
},
}
......
......@@ -488,10 +488,11 @@ export default {
console.log('oraclePk', oraclePk)
/* Initialize minimum valid block. */
const minValidBlock = 643123
// const minValidBlock = 643123
const minValidBlock = await Nito.Blockchain.getBlockHeight()
console.log('MIN VALID BLOCK', minValidBlock)
/* Initialize monthly pledge amount. */
// const monthlyPledgeAmt = 1337
const pledgeUSD = numeral(this.pledgeUSD).value()
const monthlyPledgeAmt = Math.round(pledgeUSD * 100)
console.log('MONTHLY PLEDGE AMOUNT', pledgeUSD, monthlyPledgeAmt)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment