esto marcha, ahora ya es capaz de pillar la imagen donde corresponde
parent
5611c2775b
commit
4a1711e020
@ -1,43 +1,24 @@
|
||||
import { error } from '@sveltejs/kit';
|
||||
import { getAllPostersFromDB } from '$lib/db/utils';
|
||||
import { canvas } from '$lib/stores/store';
|
||||
import { getAllPostersFromDB, addPosterToDB } from '$lib/db/utils';
|
||||
|
||||
/** @type {import('./$types').PageServerLoad} */
|
||||
export const load = async () => {
|
||||
export const load = () => {
|
||||
const posters = getAllPostersFromDB();
|
||||
if (posters !== undefined) {
|
||||
return {
|
||||
posters: posters
|
||||
posters
|
||||
}
|
||||
}
|
||||
console.log(posters);
|
||||
throw error(404, "error");
|
||||
};
|
||||
|
||||
// /** @type {import('./$types').Actions} */
|
||||
// export const actions = {
|
||||
// add: async ({ request, locals }) => {
|
||||
// const form = await request.formData();
|
||||
|
||||
// await api('POST', `todos/${locals.userid}`, {
|
||||
// text: form.get('text')
|
||||
// });
|
||||
// },
|
||||
// edit: async ({ request, locals }) => {
|
||||
// const form = await request.formData();
|
||||
|
||||
// await api('PATCH', `todos/${locals.userid}/${form.get('uid')}`, {
|
||||
// text: form.get('text')
|
||||
// });
|
||||
// },
|
||||
// toggle: async ({ request, locals }) => {
|
||||
// const form = await request.formData();
|
||||
|
||||
// await api('PATCH', `todos/${locals.userid}/${form.get('uid')}`, {
|
||||
// done: !!form.get('done')
|
||||
// });
|
||||
// },
|
||||
// delete: async ({ request, locals }) => {
|
||||
// const form = await request.formData();
|
||||
/** @type {import('./$types').Actions} */
|
||||
export const actions = {
|
||||
default: async ({ request }) => {
|
||||
console.log("Estoy aquí");
|
||||
const data = await request.formData();
|
||||
}
|
||||
|
||||
// await api('DELETE', `todos/${locals.userid}/${form.get('uid')}`);
|
||||
// }
|
||||
// };
|
||||
}
|
||||
|
@ -1,6 +1,31 @@
|
||||
<script>
|
||||
/** @type {import('./$types').PageData} */
|
||||
export let data;
|
||||
console.log(data);
|
||||
|
||||
$: posters = data.posters;
|
||||
|
||||
/** @type {Blob} */ let image = new Blob();
|
||||
/** @type {string} */ let template = '';
|
||||
/** @type {string} */ let content = '';
|
||||
</script>
|
||||
|
||||
<h1>Test</h1>
|
||||
<ul>
|
||||
{#each posters as poster}
|
||||
<li>{poster.name}</li>
|
||||
{/each}
|
||||
</ul>
|
||||
|
||||
<form method="POST">
|
||||
<input name="template" bind:value={template} placeholder="Plantilla" type="text" />
|
||||
<input name="content" bind:value={content} placeholder="Contenido" type="text" />
|
||||
<input name="image" bind:value={image} type="file" />
|
||||
<button>Send</button>
|
||||
</form>
|
||||
|
||||
<style>
|
||||
input {
|
||||
display: block;
|
||||
margin: 1rem 0;
|
||||
}
|
||||
</style>
|
||||
|
Loading…
Reference in New Issue