mirror of
https://github.com/ascribe/onion.git
synced 2024-06-30 13:41:57 +02:00
24 lines
506 B
JavaScript
24 lines
506 B
JavaScript
|
import alt from '../alt';
|
||
|
import PieceFetcher from '../fetchers/piece_fetcher';
|
||
|
|
||
|
|
||
|
class PieceActions {
|
||
|
constructor() {
|
||
|
this.generateActions(
|
||
|
'updatePiece'
|
||
|
);
|
||
|
}
|
||
|
|
||
|
fetchOne(pieceId) {
|
||
|
PieceFetcher.fetchOne(pieceId)
|
||
|
.then((res) => {
|
||
|
this.actions.updatePiece(res.piece);
|
||
|
})
|
||
|
.catch((err) => {
|
||
|
console.log(err);
|
||
|
});
|
||
|
}
|
||
|
};
|
||
|
|
||
|
export default alt.createActions(PieceActions);
|