This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.clement { | |
color:red; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Projet de loi pour une République numérique | |
TITRE IER | |
LA CIRCULATION DES DONNEES ET DU SAVOIR | |
CHAPITRE IER | |
ECONOMIE DE LA DONNEE | |
Section 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Projet de loi pour une République numérique | |
TITRE IER | |
LA CIRCULATION DES DONNEES ET DU SAVOIR | |
CHAPITRE IER | |
ECONOMIE DE LA DONNEE | |
Section 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Offer extends Component { | |
constructor() { | |
super(); | |
this.state = { | |
available: 0 | |
}; | |
} | |
componentDidMount() { | |
this.props.requestGetOffer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from flask import current_app as app, jsonify, request | |
from models import Offer, PcObject, Stock | |
@app.route('/offers/<id>', methods=['GET']) | |
@login_required | |
def get_offer(id): | |
offer = load_or_404(Offer, id) | |
return jsonify(offer._asdict(include=["stocks"])) | |
@app.route('/stocks', methods=['POST']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"id": "CD", | |
"name": "Marx et Compagnie", | |
"stocks": [ | |
{ "available": 15, "id": "AE" }, | |
{ "available": 25, "id": "BF" }, | |
] | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Fragment } from 'react' | |
const AddStock = ({ handleAddStock }) => { | |
const [available, setAvailable] = useState(0) | |
return ( | |
<Fragment> | |
<input | |
onChange={event => setAvailable(event.target.value)} | |
value={available} | |
/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const OfferContainer = compose( | |
withRouter, | |
connect( | |
mapStateToProps, | |
mapDispatchToProps | |
) | |
)(Offer); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createSelector } from 'reselect' | |
const selectOfferById = createSelector( | |
state => state.data.offers, | |
(state, offerId) => offerId, | |
(offers, offerId) => (offers || []).find(offer => offer.id === offerId) | |
) | |
export default selectOfferById |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
... | |
class Offer extends Component { | |
componentDidMount () { | |
const { dispatch, match: { params: { offerId } } } = this.props | |
dispatch(requestData({ | |
apiPath: `/offers/${offerId}`, | |
normalizer: { | |
stocks: 'stocks' | |
} |
OlderNewer