diff --git a/frontend/src/routes/+page.js b/frontend/src/routes/+page.js index 333382c..b39136a 100644 --- a/frontend/src/routes/+page.js +++ b/frontend/src/routes/+page.js @@ -1,13 +1,13 @@ /** @type {import('./$types').LayoutServerLoad} */ export async function load({ fetch }) { - const response = await fetch("http://localhost:5165/api/note", { + const response = await fetch("http://no08g0o48sc8w0woowwsskos.134.255.231.190.sslip.io/api/note", { method: 'GET', headers: { 'Content-Type': 'application/json', } }); - if(!response.ok){ + if (!response.ok) { throw new Error(`Es gab einen Fehler beim Laden der Notizen: ${response.statusText}`) } diff --git a/frontend/src/routes/createNote/+page.server.js b/frontend/src/routes/createNote/+page.server.js index 4e4ac40..a954499 100644 --- a/frontend/src/routes/createNote/+page.server.js +++ b/frontend/src/routes/createNote/+page.server.js @@ -3,12 +3,12 @@ import { redirect } from '@sveltejs/kit'; /** @satisfies {import('./$types').Actions} */ export const actions = { - create: async ({request}) => { + create: async ({ request }) => { const formData = await request.formData(); - const title = formData.get('title'); - const content = formData.get('content'); + const title = formData.get('title'); + const content = formData.get('content'); - const response = await fetch('http://localhost:5165/api/note', { + const response = await fetch('http://no08g0o48sc8w0woowwsskos.134.255.231.190.sslip.io/api/note', { method: 'POST', headers: { 'Content-Type': 'application/json', @@ -22,7 +22,7 @@ export const actions = { } const data = await response.json(); - + return goto("/") } } \ No newline at end of file diff --git a/frontend/src/routes/createNote/+page.svelte b/frontend/src/routes/createNote/+page.svelte index a3dc769..4221d85 100644 --- a/frontend/src/routes/createNote/+page.svelte +++ b/frontend/src/routes/createNote/+page.svelte @@ -10,13 +10,16 @@ content: formData.content, }; - const response = await fetch("http://localhost:5165/api/note", { - method: "POST", - headers: { - "Content-Type": "application/json", + const response = await fetch( + "http://no08g0o48sc8w0woowwsskos.134.255.231.190.sslip.io/api/note", + { + method: "POST", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(payload), }, - body: JSON.stringify(payload), - }); + ); if (response.ok) { goto("/"); diff --git a/frontend/src/routes/editNote/[id]/+page.js b/frontend/src/routes/editNote/[id]/+page.js index 0a14d1a..ec9e06f 100644 --- a/frontend/src/routes/editNote/[id]/+page.js +++ b/frontend/src/routes/editNote/[id]/+page.js @@ -2,11 +2,11 @@ import { error } from '@sveltejs/kit'; /** @type {import('./$types').PageLoad} */ export async function load({ params, fetch }) { - const request = await fetch(`http://localhost:5165/api/note/${params.id}`) + const request = await fetch(`http://no08g0o48sc8w0woowwsskos.134.255.231.190.sslip.io/api/note/${params.id}`) const note = await request.json(); - if(request.status != 200){ + if (request.status != 200) { error(request.status, note.title); } diff --git a/frontend/src/routes/editNote/[id]/+page.svelte b/frontend/src/routes/editNote/[id]/+page.svelte index 5bed651..d8d9517 100644 --- a/frontend/src/routes/editNote/[id]/+page.svelte +++ b/frontend/src/routes/editNote/[id]/+page.svelte @@ -14,14 +14,17 @@ content: formData.content, }; - const response = await fetch(`http://localhost:5165/api/note/${note.id}`, { - method: "PUT", - headers: { - "Content-Type": "application/json", + const response = await fetch( + `http://no08g0o48sc8w0woowwsskos.134.255.231.190.sslip.io/api//note/${note.id}`, + { + method: "PUT", + headers: { + "Content-Type": "application/json", + }, + body: JSON.stringify(payload), }, - body: JSON.stringify(payload), - }); - console.log(response.status) + ); + console.log(response.status); if (response.ok) { goto("/"); } else { @@ -29,13 +32,16 @@ } } - async function deleteNote(){ - const response = await fetch(`http://localhost:5165/api/note/${note.id}`, { - method: "DELETE", - headers: { - "Content-Type": "application/json", - } - }); + async function deleteNote() { + const response = await fetch( + `http://no08g0o48sc8w0woowwsskos.134.255.231.190.sslip.io/api/note/${note.id}`, + { + method: "DELETE", + headers: { + "Content-Type": "application/json", + }, + }, + ); if (response.ok) { goto("/"); @@ -75,7 +81,7 @@
-