-
-
Notifications
You must be signed in to change notification settings - Fork 97
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs(website): improve structuring the app guide
- Loading branch information
1 parent
4566327
commit 7b85e07
Showing
5 changed files
with
221 additions
and
1 deletion.
There are no files selected for viewing
42 changes: 42 additions & 0 deletions
42
packages/overmind-website/examples/guide/structuringtheapp/actions.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
export default (ts, view) => | ||
ts | ||
? [ | ||
{ | ||
fileName: 'overmind/posts/actions.ts', | ||
code: ` | ||
import { Action } from 'overmind' | ||
export const getPosts: Action = () => {} | ||
export const addNewPost: Action = () => {} | ||
`, | ||
}, | ||
{ | ||
fileName: 'overmind/admin/actions.ts', | ||
code: ` | ||
import { Action } from 'overmind' | ||
export const getUsers: Action = () => {} | ||
export const changeUserAccess: Action = () => {} | ||
`, | ||
}, | ||
] | ||
: [ | ||
{ | ||
fileName: 'overmind/posts/actions.js', | ||
code: ` | ||
export const getPosts = () => {} | ||
export const addNewPost = () => {} | ||
`, | ||
}, | ||
{ | ||
fileName: 'overmind/admin/actions.js', | ||
code: ` | ||
export const getUsers = () => {} | ||
export const changeUserAccess = () => {} | ||
`, | ||
}, | ||
] |
38 changes: 38 additions & 0 deletions
38
packages/overmind-website/examples/guide/structuringtheapp/effects.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
export default (ts, view) => | ||
ts | ||
? [ | ||
{ | ||
fileName: 'overmind/posts/effects.ts', | ||
code: ` | ||
export const postsApi = { | ||
getPostsFromServer(): Promise<Post[]> {} | ||
} | ||
`, | ||
}, | ||
{ | ||
fileName: 'overmind/admin/effects.ts', | ||
code: ` | ||
export const adminApi = { | ||
getUsersFromServer(): Promise<User[]> {} | ||
} | ||
`, | ||
}, | ||
] | ||
: [ | ||
{ | ||
fileName: 'overmind/posts/effects.js', | ||
code: ` | ||
export const postsApi = { | ||
getPostsFromServer() {} | ||
} | ||
`, | ||
}, | ||
{ | ||
fileName: 'overmind/admin/effects.js', | ||
code: ` | ||
export const adminApi = { | ||
getUsersFromServer() {} | ||
} | ||
`, | ||
}, | ||
] |
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
56 changes: 56 additions & 0 deletions
56
packages/overmind-website/examples/guide/structuringtheapp/state.ts
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
export default (ts, view) => | ||
ts | ||
? [ | ||
{ | ||
fileName: 'overmind/posts/state.ts', | ||
code: ` | ||
export type Post = { | ||
id: number | ||
title: string | ||
} | ||
export type State = { | ||
posts: Post[] | ||
} | ||
export const state: State = { | ||
posts: [] | ||
} | ||
`, | ||
}, | ||
{ | ||
fileName: 'overmind/admin/state.ts', | ||
code: ` | ||
export type User = { | ||
id: number | ||
name: string | ||
} | ||
export type State = { | ||
users: User[] | ||
} | ||
export const state: State = { | ||
users: [] | ||
} | ||
`, | ||
}, | ||
] | ||
: [ | ||
{ | ||
fileName: 'overmind/posts/state.js', | ||
code: ` | ||
export const state = { | ||
posts: [] | ||
} | ||
`, | ||
}, | ||
{ | ||
fileName: 'overmind/admin/state.js', | ||
code: ` | ||
export const state = { | ||
users: [] | ||
} | ||
`, | ||
}, | ||
] |
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