Commit 3aba7d16 authored by Bitcoin Please's avatar Bitcoin Please

Added new API provider.

parent 1dbdfd68
......@@ -10,9 +10,11 @@ const addAssurance = async ({ rootGetters }, _assurance) => {
const signedPkg = rootGetters['profile/getSignedMessage'](JSON.stringify(_assurance))
// console.log('SIGNED PACKAGE', signedPkg)
/* Retrieve API provider. */
const API_PROVIDER = rootGetters.getApiProvider
/* Set api target. */
const target = 'http://localhost:6767/v1/assurances'
// const target = 'https://api.causes.cash/v1/assurances'
const target = `${API_PROVIDER}/assurances`
const result = await superagent
.post(target)
......
......@@ -9,9 +9,11 @@ const addPayout = async ({ rootGetters }, _payout) => {
const signedPkg = rootGetters['profile/getSignedMessage'](JSON.stringify(_payout))
// console.log('SIGNED PACKAGE', signedPkg)
/* Retrieve API provider. */
const API_PROVIDER = rootGetters.getApiProvider
/* Set api target. */
const target = 'http://localhost:6767/v1/payouts'
// const target = 'https://api.causes.cash/v1/payouts'
const target = `${API_PROVIDER}/payouts`
/* Make remote call. */
const result = await superagent
......
......@@ -10,10 +10,13 @@ const updateCampaign = async ({ rootGetters }, _campaign) => {
const signedPkg = rootGetters['profile/getSignedMessage'](JSON.stringify(_campaign))
// console.log('SIGNED PACKAGE', signedPkg)
/* Retrieve API provider. */
const API_PROVIDER = rootGetters.getApiProvider
/* Set api target. */
const target = 'http://localhost:6767/v1/campaigns'
// const target = 'https://api.causes.cash/v1/campaigns'
const target = `${API_PROVIDER}/campaigns`
/* Request campaign update. */
const result = await superagent
.put(target)
.send(signedPkg)
......
......@@ -4,14 +4,17 @@ import superagent from 'superagent'
/**
* Get Campaign
*/
const getCampaign = () => async (_ownerSlug, _campaignSlug) => {
const getCampaign = (state, getters, rootState, rootGetters) => async (_ownerSlug, _campaignSlug) => {
// console.log('Retrieving campaign...', _ownerSlug, _campaignId)
/* Initialize campaign. */
// let campaign = null
/* Retrieve API provider. */
const API_PROVIDER = rootGetters.getApiProvider
/* Set target. */
const target = `https://api.causes.cash/v1/campaigns/${_ownerSlug}/${_campaignSlug}`
const target = `${API_PROVIDER}/campaigns/${_ownerSlug}/${_campaignSlug}`
// console.log('TARGET', target)
/* Request campaign. */
......
......@@ -4,15 +4,14 @@ import superagent from 'superagent'
/**
* Get Campaigns
*/
const getCampaigns = () => async (_ownerSlug) => {
const getCampaigns = (state, getters, rootState, rootGetters) => async (_ownerSlug) => {
// console.log('Retrieving campaign...', _ownerSlug, _campaignId)
/* Initialize campaign. */
// let campaign = null
/* Retrieve API provider. */
const API_PROVIDER = rootGetters.getApiProvider
/* Set target. */
const target = `http://localhost:6767/v1/campaigns/${_ownerSlug}`
// const target = `https://api.causes.cash/v1/campaigns/${_ownerSlug}`
const target = `${API_PROVIDER}/campaigns/${_ownerSlug}`
// console.log('TARGET', target)
/* Request campaigns. */
......
......@@ -32,7 +32,7 @@ function _encrypt(_plaintext, _key, _algo = 'aes-256-cbc') {
*
* Metadata is used to store details about addresses.
*/
const updateMeta = async ({ commit, getters }, _meta) => {
const updateMeta = async ({ commit, getters, rootGetters }, _meta) => {
/* Commit metadata. */
commit('setMeta', _meta)
......@@ -51,9 +51,11 @@ const updateMeta = async ({ commit, getters }, _meta) => {
const signedPkg = getters.getSignedMessage(encrypted)
// console.log('SIGNED PACKAGE', signedPkg)
/* Retrieve API provider. */
const API_PROVIDER = rootGetters.getApiProvider
/* Set api target. */
const target = 'http://localhost:6767/v1/profiles'
// const target = 'https://api.causes.cash/v1/meta'
const target = `${API_PROVIDER}/profiles`
/* Call api. */
await superagent
......
......@@ -54,9 +54,11 @@ const getMeta = async (state, getters, rootState, rootGetters) => {
const address = Nito.Address.toCashAddress(childNode)
// console.log('GET SIGNED MESSAGE (address):', address)
/* Retrieve API provider. */
const API_PROVIDER = rootGetters.getApiProvider
/* Set target. */
const target = `http://localhost:6767/v1/profiles/${address}`
// const target = `https://api.causes.cash/v1/profiles/${address}`
const target = `${API_PROVIDER}/profiles/${address}`
/* Set contract path. */
const response = await superagent.get(target)
......
......@@ -5,8 +5,8 @@
*/
const getApiProvider = () => {
/* Return url endpoint. */
return 'http://localhost:6767/v1/'
// return 'https://api.causes.cash/v1/'
return 'http://localhost:6767/v1'
// return 'https://api.causes.cash/v1'
}
/* Export module. */
......
......@@ -129,8 +129,7 @@ export default {
// console.log('SLUG', this.slug)
/* Set live URL. */
// FOR DEVELOPMENT ONLY
this.liveUrl = `http://localhost:8080/#/@${this.ownerSlug}/${this.slug}-null`
this.liveUrl = `https://causes.cash/@${this.ownerSlug}/${this.slug}-null`
},
mounted: function () {
......
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