Reputation: 10407
Using the AWS SDK from typescript (please excuse the code, it's still in development):
In my Angular2 service:
return this.bucket.deleteObject(params).promise();
In my component:
this.uploadService.delete(key).then(/*returns before bucket is consistent, listing its contents still shows the deleted item for a few seconds);
How can I keep my UI consistent with the state of the S3 bucket? Do I have to poll it for a few seconds afterward and show some kind of progress indicator?
Upvotes: 0
Views: 25
Reputation: 2034
Hey had a quick look at how you are accessing the promise. I dont think you need .promise() in the service. Have you tried it like this:
export class TestComponent
{
private key = 'something';
constructor(private uploadService: UploadService)
{
}
ngOnInit()
{
this.uploadService
.delete(this.key)
.then((err, data) =>
{
if (err)
{
console.log(err, err.stack);
}
else
{
console.log(data);
}
})
}
}
export class UploadService
{
delete(params)
{
return this.bucket.deleteObject(params);
}
}
Upvotes: 1