Commit e3b4109d authored by Morgan McMillian's avatar Morgan McMillian

attach oembed to post

parent f305310b
......@@ -350,6 +350,13 @@ export class StreamPage {
</button>
</ion-col>
</ion-row>
<ion-list>
<ion-item>
<ion-thumbnail item-start>
</ion-thumbnail>
<p>filename</p>
</ion-item>
</ion-list>
</ion-card>
</ion-content>
`
......@@ -418,10 +425,12 @@ export class NewPostModal {
this.options['raw'] = this.raw;
pnut.createPost(this.ptext, this.options).then(res => {
console.log(res);
console.log('-success-');
console.log(JSON.stringify(res));
this.presentToast("Status posted.");
this.events.publish('stream:reload', {});
}).catch(err => {
console.log('-error posting-');
console.log(JSON.stringify(err));
});
this.viewCtrl.dismiss();
......@@ -491,8 +500,21 @@ export class NewPostModal {
fileTransfer.upload(this.fpath, 'https://api.pnut.io/v0/files', options).then((response) => {
console.log('-file created-');
console.log(JSON.stringify(response));
console.log(response.response);
console.log('-file created-');
let rdata = JSON.parse(response.response);
let oembed = {
'+io.pnut.core.file': {
file_id: rdata.data.id,
file_token: rdata.data.file_token,
format: 'oembed'
}
}
console.log(JSON.stringify(oembed));
this.raw.push({
type: "io.pnut.core.oembed",
value: oembed
});
}).catch((err) => {
console.log('-create file error-');
console.log(JSON.stringify(err));
......
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