Skip to content

Instantly share code, notes, and snippets.

@DreySkee
DreySkee / index.html
Created June 16, 2017 16:20
4 - Wordpress API + ReactJS (Updated)
<!DOCTYPE html>
<html>
<head>
<title>React with Wordpress API</title>
</head>
<body>
<div id="app"></div>
</body>
</html>
@DreySkee
DreySkee / webpack.production.js
Last active June 16, 2017 16:16
3 - Wordpress API + ReactJS (Updated)
var webpack = require('webpack');
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
devtool: 'source-map',
devServer: {
historyApiFallback: true, // This will make the server understand "/some-link" routs instead of "/#/some-link"
},
entry: [
@DreySkee
DreySkee / webpack.dev.js
Last active June 16, 2017 16:16
2 - Wordpress API + ReactJS (Updated)
var webpack = require('webpack');
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = {
devtool: 'cheap-module-source-map',
devServer: {
historyApiFallback: true, // This will make the server understand "/some-link" routs instead of "/#/some-link"
},
entry: [
@DreySkee
DreySkee / package.json
Last active June 16, 2017 18:13
1 - Wordpress API + ReactJS (Updated)
{
"name": "wp-api-react",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "webpack-dev-server --inline --progress --config webpack.dev.js",
"build": "npm run clean && webpack -p --progress --config webpack.production.js",
"clean": "rimraf ./build/*"
@DreySkee
DreySkee / DataActions_Menus.js
Last active January 24, 2019 06:21
WP-API DataActions with menus endpoint
import axios from 'axios';
import alt from './../alt/alt.js';
class DataActions {
constructor() {
const appUrl = 'http://andreypokrovskiy.com/projects/wp-api'; // Wordpress installation url
this.pagesEndPoint = `${appUrl}/wp-json/wp/v2/pages`; // Endpoint for getting Wordpress Pages
this.postsEndPoint = `${appUrl}/wp-json/wp/v2/posts`; // Endpoint for getting Wordpress Posts
stripe.transfers.create(
{
amount: 100,
currency: "usd",
destination: "default_for_currency",
source_type: "bank_account"
},
{stripe_account: "acct_19qSMyGNNhYMoOcx"}
);
{
"object": {
"object": "balance",
"available": [
{
"currency": "usd",
"amount": 4247538,
"source_types": {
"card": 4247538
}
@DreySkee
DreySkee / App.js
Last active February 2, 2017 01:07
16 - Wordpress API + ReactJS
import React from 'react';
import Nav from './Nav.js';
export default class App extends React.Component {
constructor(props) {
super(props);
}
render() {
@DreySkee
DreySkee / Nav.js
Created February 2, 2017 01:02
15 - Wordpress API + ReactJS
import React from 'react';
import { Link } from 'react-router';
import _ from 'lodash';
import DataStore from './../stores/DataStore.js';
class Nav extends React.Component {
render() {
let allPages = DataStore.getAllPages();
allPages = _.sortBy(allPages, [function(page) { return page.menu_order; }]);
@DreySkee
DreySkee / index.js
Last active February 5, 2017 19:16
14 - Wordpress API + ReactJS
import React from 'react';
import {render} from 'react-dom';
import App from './components/App.js';
import Home from './components/Home.js';
import views from './components/views.js';
import {
browserHistory,
IndexRoute,
Redirect,