https://github.com/pseudomuto/shopify-api-flux
An implementation of the Shopify API in Flux
https://github.com/pseudomuto/shopify-api-flux
Last synced: 10 months ago
JSON representation
An implementation of the Shopify API in Flux
- Host: GitHub
- URL: https://github.com/pseudomuto/shopify-api-flux
- Owner: pseudomuto
- License: mit
- Created: 2015-08-27T21:26:45.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2015-10-04T15:25:54.000Z (over 10 years ago)
- Last Synced: 2025-07-21T03:42:40.108Z (11 months ago)
- Language: JavaScript
- Homepage: http://pseudomuto.com/shopify-api-flux/
- Size: 2.49 MB
- Stars: 3
- Watchers: 1
- Forks: 1
- Open Issues: 23
-
Metadata Files:
- Readme: README.md
- Contributing: CONTRIBUTING.md
- License: LICENSE
Awesome Lists containing this project
README
# Shopify API Flux
[](https://travis-ci.org/pseudomuto/shopify-api-flux) [](http://badge.fury.io/js/shopify-api-flux)
A flux implementation of the Shopify API.
## Installation
```sh
npm install --save shopify-api-flux
```
## Usage
This project uses ES6 (via Babel et al.). So the examples are in ES6. However, since the distribution (and main file in
package.json) is actually compiled down to ES5, you should be able to use this in your ES5 projects without issue.
Please let me know (or open a PR) if this is not the case.
### Examples
Currently, there is only one example but I intend to add more over time. For now there is a react native app in the
examples/native directory that demonstrates creating and storing a session as well as fetching orders, products and shop
details.
This will get fleshed out more as the API comes closer to complete.
### Quick Start
```javascript
import ShopifyAPI from "shopify-api-flux";
const { Session, Shop } = ShopifyAPI;
// set the Domain and API token
Session.init("YOUR_SHOP", "YOUR_API_TOKEN")
class ShopView extends React.Component {
constructor(props) {
super(props);
this.state = { shop: null }
}
render() {
return (
// YOUR VIEW CODE
);
}
componentWillMount() {
Shop.store.addListener(this._onChange.bind(this));
}
componentDidMount() {
Shop.fetch()
}
_onChange() {
this.setState({ shop: Shop.store.getCurrent() });
}
}
```