Compare commits

..

3 Commits

Author SHA1 Message Date
73ae6d89f8 Update home screenshot 2018-03-13 19:10:51 +01:00
171bf33fff Add screenshots 2018-03-13 19:09:16 +01:00
680f00c188 Factor API calls 2018-03-13 19:02:10 +01:00
6 changed files with 19 additions and 14 deletions

View File

@ -5,6 +5,10 @@ Cuizin is a tool wrapping around [Web Outside Of Browsers](http://weboob.org/)
to help you sort and organize recipes you find online. You can also manually to help you sort and organize recipes you find online. You can also manually
add new recipes. add new recipes.
![Homepage](screenshots/home.png)
More screenshots are available in the [`screenshots` folder](screenshots/).
## Installation ## Installation

View File

@ -1,6 +1,14 @@
import * as constants from '@/constants'; import * as constants from '@/constants';
function fetchAPI(endpoint, params = {}) {
return fetch(
`${constants.API_URL}${endpoint}`,
Object.assign({}, { credentials: 'same-origin' }, params),
);
}
function loadJSON(response) { function loadJSON(response) {
return response.json(); return response.json();
} }
@ -29,59 +37,52 @@ function _postProcessRecipes(response) {
export function loadRecipes() { export function loadRecipes() {
return fetch(`${constants.API_URL}api/v1/recipes`, { credentials: 'same-origin' }) return fetchAPI('api/v1/recipes')
.then(_postProcessRecipes); .then(_postProcessRecipes);
} }
export function loadRecipe(id) { export function loadRecipe(id) {
return fetch(`${constants.API_URL}api/v1/recipe/${id}`, { credentials: 'same-origin' }) return fetchAPI(`api/v1/recipe/${id}`)
.then(_postProcessRecipes); .then(_postProcessRecipes);
} }
export function refetchRecipe(id) { export function refetchRecipe(id) {
return fetch( return fetchAPI(`api/v1/recipe/${id}/refetch`)
`${constants.API_URL}api/v1/recipe/${id}/refetch`,
{ credentials: 'same-origin' },
)
.then(_postProcessRecipes); .then(_postProcessRecipes);
} }
export function postRecipeByUrl(recipe) { export function postRecipeByUrl(recipe) {
return fetch(`${constants.API_URL}api/v1/recipes/by_url`, { return fetchAPI('api/v1/recipes/by_url', {
method: 'POST', method: 'POST',
body: JSON.stringify(recipe), body: JSON.stringify(recipe),
credentials: 'same-origin',
}) })
.then(_postProcessRecipes); .then(_postProcessRecipes);
} }
export function postRecipeManually(recipe) { export function postRecipeManually(recipe) {
return fetch(`${constants.API_URL}api/v1/recipes/manually`, { return fetchAPI('api/v1/recipes/manually', {
method: 'POST', method: 'POST',
body: JSON.stringify(recipe), body: JSON.stringify(recipe),
credentials: 'same-origin',
}) })
.then(_postProcessRecipes); .then(_postProcessRecipes);
} }
export function editRecipe(id, recipe) { export function editRecipe(id, recipe) {
return fetch(`${constants.API_URL}api/v1/recipe/${id}`, { return fetchAPI(`api/v1/recipe/${id}`, {
method: 'POST', method: 'POST',
body: JSON.stringify(recipe), body: JSON.stringify(recipe),
credentials: 'same-origin',
}) })
.then(_postProcessRecipes); .then(_postProcessRecipes);
} }
export function deleteRecipe(id) { export function deleteRecipe(id) {
return fetch(`${constants.API_URL}api/v1/recipe/${id}`, { return fetchAPI(`api/v1/recipe/${id}`, {
method: 'DELETE', method: 'DELETE',
credentials: 'same-origin',
}); });
} }

BIN
screenshots/add_recipe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 27 KiB

BIN
screenshots/home.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 459 KiB

BIN
screenshots/recipe.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 751 KiB