Compare commits

..

No commits in common. "master" and "httpAuth" have entirely different histories.

6 changed files with 14 additions and 19 deletions

View File

@ -5,10 +5,6 @@ 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,14 +1,6 @@
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();
} }
@ -37,52 +29,59 @@ function _postProcessRecipes(response) {
export function loadRecipes() { export function loadRecipes() {
return fetchAPI('api/v1/recipes') return fetch(`${constants.API_URL}api/v1/recipes`, { credentials: 'same-origin' })
.then(_postProcessRecipes); .then(_postProcessRecipes);
} }
export function loadRecipe(id) { export function loadRecipe(id) {
return fetchAPI(`api/v1/recipe/${id}`) return fetch(`${constants.API_URL}api/v1/recipe/${id}`, { credentials: 'same-origin' })
.then(_postProcessRecipes); .then(_postProcessRecipes);
} }
export function refetchRecipe(id) { export function refetchRecipe(id) {
return fetchAPI(`api/v1/recipe/${id}/refetch`) return fetch(
`${constants.API_URL}api/v1/recipe/${id}/refetch`,
{ credentials: 'same-origin' },
)
.then(_postProcessRecipes); .then(_postProcessRecipes);
} }
export function postRecipeByUrl(recipe) { export function postRecipeByUrl(recipe) {
return fetchAPI('api/v1/recipes/by_url', { return fetch(`${constants.API_URL}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 fetchAPI('api/v1/recipes/manually', { return fetch(`${constants.API_URL}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 fetchAPI(`api/v1/recipe/${id}`, { return fetch(`${constants.API_URL}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 fetchAPI(`api/v1/recipe/${id}`, { return fetch(`${constants.API_URL}api/v1/recipe/${id}`, {
method: 'DELETE', method: 'DELETE',
credentials: 'same-origin',
}); });
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 459 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 751 KiB