-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Close burgermenu after search * Set instructions white/space paragraph to pre-line to preserve newline characters * Sett the x-api-key header on the api calls * Update security headers sent in hooks.server.ts and update Dockerfile with api key * Correct X-Content-Type-Options header value * Slugify recipe name in RecipeCard * Use replaceAll * Layout adjustments * Set header opacity to 0.95 * Add header bottom border when burgermenu is open * Deslugify recipe name when not found * Add see more recipes button in home * Set navbar max height to 100vh in mobile to fix not being able to submit button on smaller heights * Use pnpm instead of npm * Update height of images * Squashed commit of the following: commit 5c8a416 Author: Luz <luzojeda@proton.me> Date: Fri Apr 5 15:57:58 2024 -0300 Add space after Preparación in individual recipe page commit 923799c Author: Luz <luzojeda@proton.me> Date: Fri Apr 5 15:47:54 2024 -0300 Change laptop grid to 4 commit adf8c38 Author: Luz Ojeda <luzojeda@proton.me> Date: Fri Apr 5 15:28:36 2024 -0300 Develop (#39) * Close burgermenu after search * Set instructions white/space paragraph to pre-line to preserve newline characters * Sett the x-api-key header on the api calls * Update security headers sent in hooks.server.ts and update Dockerfile with api key * Correct X-Content-Type-Options header value * Slugify recipe name in RecipeCard * Use replaceAll * Layout adjustments * Set header opacity to 0.95 commit af71728 Author: Luz Ojeda <luzojeda@proton.me> Date: Wed Apr 3 18:33:44 2024 -0300 Develop (#35) * Close burgermenu after search * Set instructions white/space paragraph to pre-line to preserve newline characters * Sett the x-api-key header on the api calls * Update security headers sent in hooks.server.ts and update Dockerfile with api key * Correct X-Content-Type-Options header value * Slugify recipe name in RecipeCard * Use replaceAll * Layout adjustments * Format * Squashed commit of the following: commit 5c8a416 Author: Luz <luzojeda@proton.me> Date: Fri Apr 5 15:57:58 2024 -0300 Add space after Preparación in individual recipe page commit 923799c Author: Luz <luzojeda@proton.me> Date: Fri Apr 5 15:47:54 2024 -0300 Change laptop grid to 4 commit adf8c38 Author: Luz Ojeda <luzojeda@proton.me> Date: Fri Apr 5 15:28:36 2024 -0300 Develop (#39) * Close burgermenu after search * Set instructions white/space paragraph to pre-line to preserve newline characters * Sett the x-api-key header on the api calls * Update security headers sent in hooks.server.ts and update Dockerfile with api key * Correct X-Content-Type-Options header value * Slugify recipe name in RecipeCard * Use replaceAll * Layout adjustments * Set header opacity to 0.95 commit af71728 Author: Luz Ojeda <luzojeda@proton.me> Date: Wed Apr 3 18:33:44 2024 -0300 Develop (#35) * Close burgermenu after search * Set instructions white/space paragraph to pre-line to preserve newline characters * Sett the x-api-key header on the api calls * Update security headers sent in hooks.server.ts and update Dockerfile with api key * Correct X-Content-Type-Options header value * Slugify recipe name in RecipeCard * Use replaceAll * Layout adjustments * Set navbar overflow-y to auto * Add fly.yml * Set package version to 1.0.0, change recipe page layout * Change package version to 1.1.0 to account for the recipe creation functionality plus protected route * Most basic happy path recipe creation page implementing Basic Auth for protected routes as well * Add isotipo * Add type prop to PrimaryButton and set width default to auto * Update RecipesSearchForm * Add errors array of objects property to ApiError type * Adjust footer logotipo alignment in mobile/tablet * Improve response of recipe creation
- Loading branch information
Showing
17 changed files
with
267 additions
and
30 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
{ | ||
"name": "cook-web", | ||
"version": "1.0.0", | ||
"version": "1.1.0", | ||
"private": true, | ||
"scripts": { | ||
"dev": "vite dev", | ||
|
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
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file not shown.
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
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
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
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
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
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
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
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 @@ | ||
import type { Actions } from './$types'; | ||
import { env } from '$env/dynamic/private'; | ||
import { fail } from '@sveltejs/kit'; | ||
|
||
export const actions = { | ||
default: async ({ request }) => { | ||
const data = await request.formData(); | ||
const recipeName = data.get('name'); | ||
|
||
const body = { | ||
name: recipeName, | ||
summary: data.get('summary') || null, | ||
ingredients: data.getAll('ingredients'), | ||
instructions: data.get('instructions'), | ||
preparationTime: data.get('preparationTime') || null, | ||
cookingTime: data.get('cookingTime') || null, | ||
servings: data.get('servings') || null, | ||
difficulty: data.get('difficulty'), | ||
vegetarian: Boolean(data.get('vegetarian')) | ||
}; | ||
|
||
const response = await fetch(`${env.API_URL}/recipes`, { | ||
method: 'POST', | ||
headers: { | ||
'Content-Type': 'application/json' | ||
}, | ||
body: JSON.stringify(body) | ||
}); | ||
|
||
const responseJson = await response.json(); | ||
|
||
if (response.status === 201) { | ||
return { success: true, data: responseJson }; | ||
} | ||
|
||
if (response.status === 409) { | ||
return fail(response.status, { failure: true, message: `La receta con el nombre ${recipeName} ya existe` }); | ||
} | ||
|
||
return fail(response.status); | ||
} | ||
} satisfies Actions; |
Oops, something went wrong.