Compare commits
No commits in common. "master" and "httpAuth" have entirely different histories.
@ -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
|
||||
add new recipes.
|
||||
|
||||
![Homepage](screenshots/home.png)
|
||||
|
||||
More screenshots are available in the [`screenshots` folder](screenshots/).
|
||||
|
||||
|
||||
## Installation
|
||||
|
||||
|
@ -1,14 +1,6 @@
|
||||
import * as constants from '@/constants';
|
||||
|
||||
|
||||
function fetchAPI(endpoint, params = {}) {
|
||||
return fetch(
|
||||
`${constants.API_URL}${endpoint}`,
|
||||
Object.assign({}, { credentials: 'same-origin' }, params),
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
function loadJSON(response) {
|
||||
return response.json();
|
||||
}
|
||||
@ -37,52 +29,59 @@ function _postProcessRecipes(response) {
|
||||
|
||||
|
||||
export function loadRecipes() {
|
||||
return fetchAPI('api/v1/recipes')
|
||||
return fetch(`${constants.API_URL}api/v1/recipes`, { credentials: 'same-origin' })
|
||||
.then(_postProcessRecipes);
|
||||
}
|
||||
|
||||
|
||||
export function loadRecipe(id) {
|
||||
return fetchAPI(`api/v1/recipe/${id}`)
|
||||
return fetch(`${constants.API_URL}api/v1/recipe/${id}`, { credentials: 'same-origin' })
|
||||
.then(_postProcessRecipes);
|
||||
}
|
||||
|
||||
|
||||
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);
|
||||
}
|
||||
|
||||
|
||||
export function postRecipeByUrl(recipe) {
|
||||
return fetchAPI('api/v1/recipes/by_url', {
|
||||
return fetch(`${constants.API_URL}api/v1/recipes/by_url`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(recipe),
|
||||
credentials: 'same-origin',
|
||||
})
|
||||
.then(_postProcessRecipes);
|
||||
}
|
||||
|
||||
|
||||
export function postRecipeManually(recipe) {
|
||||
return fetchAPI('api/v1/recipes/manually', {
|
||||
return fetch(`${constants.API_URL}api/v1/recipes/manually`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(recipe),
|
||||
credentials: 'same-origin',
|
||||
})
|
||||
.then(_postProcessRecipes);
|
||||
}
|
||||
|
||||
|
||||
export function editRecipe(id, recipe) {
|
||||
return fetchAPI(`api/v1/recipe/${id}`, {
|
||||
return fetch(`${constants.API_URL}api/v1/recipe/${id}`, {
|
||||
method: 'POST',
|
||||
body: JSON.stringify(recipe),
|
||||
credentials: 'same-origin',
|
||||
})
|
||||
.then(_postProcessRecipes);
|
||||
}
|
||||
|
||||
|
||||
export function deleteRecipe(id) {
|
||||
return fetchAPI(`api/v1/recipe/${id}`, {
|
||||
return fetch(`${constants.API_URL}api/v1/recipe/${id}`, {
|
||||
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 |
Loading…
Reference in New Issue
Block a user