Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: add release workflow and build settings (rebuild) #45

Merged
merged 7 commits into from
Dec 3, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
refactor(api): improve the api parameter call
  • Loading branch information
mheob committed Nov 28, 2020
commit 107b4cb746d6fd234e2dc049a58f6238fc8ec769
11 changes: 7 additions & 4 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# macOS
.DS_Store

# DeepCode
.dccache

# expo
node_modules/**/*
.expo/
Expand All @@ -10,8 +16,5 @@ npm-debug.*
*.orig.*
web-build/

# macOS
.DS_Store

# testing
/coverage
coverage
1 change: 1 addition & 0 deletions src/screens/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ interface Style extends DefaultStyles {

const styles = StyleSheet.create<Style>({
...defaultStyles,
// TODO: Can this get removed?
sectionHeaderContainer: {},
title: {
...defaultStyles.title,
Expand Down
30 changes: 15 additions & 15 deletions src/utils/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,27 +37,27 @@ export const fetchPostAsync = async (postId: number): Promise<Response> => {
*
* @param parameter The parameter for the WordPress REST API query.
*/
export const fetchPostsAsync = async (parameter?: {
categoryId?: number | string
page?: number | string
perPage?: number | string
}): Promise<Response> => {
const categoryQuery = parameter?.categoryId ? '&categories=' + parameter.categoryId : ''
const perPageQuery = '&per_page=' + (parameter?.perPage ? parameter.perPage : '20')
const pageQuery = parameter?.page ? '&page=' + parameter.page : ''
export const fetchPostsAsync = async ({
categoryId,
page,
perPage,
}: { categoryId?: number | string; page?: number | string; perPage?: number | string } = {}): Promise<Response> => {
const categoryQuery = categoryId ? '&categories=' + categoryId : ''
const perPageQuery = '&per_page=' + (perPage ? perPage : '20')
const pageQuery = page ? '&page=' + page : ''
return await fetch(API_URL_WP + API_WP_TYPE.POSTS + API_WP_FIELDS.POSTS + categoryQuery + perPageQuery + pageQuery)
}

/**
* Fetches the categories from the WordPress API.
*
* @param parameter The parameter for the WordPress REST API query.
* @param The parameter for the WordPress REST API query.
*/
export const fetchCategoriesAsync = async (parameter?: {
perPage?: number | string
orderBy?: string
}): Promise<Response> => {
const perPageQuery = '&per_page=' + (parameter?.perPage ? parameter.perPage : '99')
const orderByQuery = '&orderby=' + (parameter?.orderBy ? parameter.orderBy : 'description')
export const fetchCategoriesAsync = async ({
perPage,
orderBy,
}: { perPage?: number | string; orderBy?: string } = {}): Promise<Response> => {
const perPageQuery = '&per_page=' + (perPage ? perPage : '99')
const orderByQuery = '&orderby=' + (orderBy ? orderBy : 'description')
return await fetch(API_URL_WP + API_WP_TYPE.CATEGORIES + API_WP_FIELDS.CATEGORIES + perPageQuery + orderByQuery)
}