November 2019
Beginner
804 pages
20h 1m
English
This is the final method for our service. Its code shouldn't require any more explanations:
removeMediaCollection(identifier: string): Promise<void> {
return new Promise<void>((resolve, reject) => {
if (!identifier || '' === identifier.trim()) {
reject(new Error("The identifier must be provided!"));
}
console.log(`Removing media collection with the following identifier ${identifier}`);
this._store.removeItem(identifier)
.then(() => {
console.log(`Removed the ${identifier} collection successfully!`);
resolve();
})
.catch(err => {
console.error(`Failed to removed the ${identifier} collection`);
reject(err);
});
});
}
Great! Our service is now fully implemented. We'll see how it is used later ...
Read now
Unlock full access