Passing calls from options page to channel new

This commit is contained in:
Paul Kirby 2018-10-04 19:19:06 -05:00
parent 6cc2bf8800
commit 41b3c58d41
3 changed files with 15 additions and 5 deletions

View file

@ -192,7 +192,7 @@ class LBRY_Admin
$bid_amount = $_POST['bid_amount'];
// TODO: Wrap in a try catch
LBRY()->daemon->channel_new($new_channel, $bid_amount);
$result = LBRY()->daemon->channel_new($new_channel, $bid_amount);
LBRY()->notice->set_notice('success', 'Successfully added a new channel!', true);
}

View file

@ -41,12 +41,12 @@ class LBRY_Daemon
/**
* https://lbryio.github.io/lbry/#channel_list
* @return array claim dictionary
* @return array claim dictionary or null if empty
*/
public function channel_list()
{
$result = $this->request('channel_list');
return null;
$result = json_decode($this->request('channel_list'))->result;
return empty($result) ? null : $result;
}
/**
@ -55,6 +55,14 @@ class LBRY_Daemon
*/
public function channel_new($channel_name, $bid_amount)
{
$result = $this->request(
'channel_new',
array(
'channel_name' => $channel_name,
'amount' => $bid_amount
)
);
error_log($result);
return null;
}

View file

@ -20,7 +20,9 @@ $channel_list = $LBRY->daemon->channel_list();
<h2>Your Publishable Channels</h2>
<?php if ($channel_list): ?>
<?php foreach ($channel as $key => $value): ?>
<?php endforeach; ?>
<?php else: ?>
<p>Looks like you haven't added any channels yet, feel free to do so below:</p>
<?php endif; ?>