File tree Expand file tree Collapse file tree 2 files changed +11
-9
lines changed
packages/overmind-website/examples/guide/getstarted Expand file tree Collapse file tree 2 files changed +11
-9
lines changed Original file line number Diff line number Diff line change @@ -8,7 +8,7 @@ export default (ts, view) =>
88 code : `
99import { Action } from 'overmind'
1010
11- export const loadPosts : Action = async ({ state, effects }) => {
11+ export const getPosts : Action = async ({ state, effects }) => {
1212 state.isLoadingPosts = true
1313 state.posts = await effects.jsonPlaceholder.getPosts()
1414 state.isLoadingPosts = false
@@ -46,13 +46,15 @@ export const overmind = new Overmind({
4646 posts: []
4747 },
4848 effects: {
49- getPosts() {
50- return fetch('https://jsonplaceholder.typicode.com/posts')
51- .then(response => response.json())
49+ jsonPlaceholder: {
50+ getPosts() {
51+ return fetch('https://jsonplaceholder.typicode.com/posts')
52+ .then(response => response.json())
53+ }
5254 }
5355 },
5456 actions: {
55- loadPosts : async ({ state, effects }) => {
57+ getPosts : async ({ state, effects }) => {
5658 state.isLoadingPosts = true
5759 state.posts = await effects.jsonPlaceholder.getPosts()
5860 state.isLoadingPosts = false
Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ import { connect } from '../overmind'
99
1010class Posts extends React.Component {
1111 componentDidMount() {
12- this.props.overmind.actions.loadPosts ()
12+ this.props.overmind.actions.getPosts ()
1313 }
1414 render() {
1515 const { overmind } = this.props
@@ -52,7 +52,7 @@ import { connect } from '../overmind'
5252
5353export default connect({
5454 mounted() {
55- this.overmind.actions.loadPosts ()
55+ this.overmind.actions.getPosts ()
5656 }
5757})
5858 ` ,
@@ -70,7 +70,7 @@ import { Connect, connect } from '../overmind'
7070
7171class Posts extends React.Component<Connect> {
7272 componentDidMount() {
73- this.props.overmind.actions.loadPosts ()
73+ this.props.overmind.actions.getPosts ()
7474 }
7575 render() {
7676 const { overmind } = this.props
@@ -115,7 +115,7 @@ import { connect } from '../overmind'
115115@connect()
116116export class PostsList {
117117 ngOnInit() {
118- this.overmind.actions.loadPosts ()
118+ this.overmind.actions.getPosts ()
119119 }
120120}
121121 ` ,
You can’t perform that action at this time.
0 commit comments