Added new Backend Address

This commit is contained in:
2025-02-08 20:21:10 +01:00
parent ab378e7fb5
commit edf64aedff
16 changed files with 43 additions and 34 deletions

View File

@@ -1,13 +1,13 @@
/** @type {import('./$types').LayoutServerLoad} */ /** @type {import('./$types').LayoutServerLoad} */
export async function load({ fetch }) { 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', method: 'GET',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
} }
}); });
if(!response.ok){ if (!response.ok) {
throw new Error(`Es gab einen Fehler beim Laden der Notizen: ${response.statusText}`) throw new Error(`Es gab einen Fehler beim Laden der Notizen: ${response.statusText}`)
} }

View File

@@ -3,12 +3,12 @@ import { redirect } from '@sveltejs/kit';
/** @satisfies {import('./$types').Actions} */ /** @satisfies {import('./$types').Actions} */
export const actions = { export const actions = {
create: async ({request}) => { create: async ({ request }) => {
const formData = await request.formData(); const formData = await request.formData();
const title = formData.get('title'); const title = formData.get('title');
const content = formData.get('content'); 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', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View File

@@ -10,13 +10,16 @@
content: formData.content, content: formData.content,
}; };
const response = await fetch("http://localhost:5165/api/note", { const response = await fetch(
method: "POST", "http://no08g0o48sc8w0woowwsskos.134.255.231.190.sslip.io/api/note",
headers: { {
"Content-Type": "application/json", method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify(payload),
}, },
body: JSON.stringify(payload), );
});
if (response.ok) { if (response.ok) {
goto("/"); goto("/");

View File

@@ -2,11 +2,11 @@ import { error } from '@sveltejs/kit';
/** @type {import('./$types').PageLoad} */ /** @type {import('./$types').PageLoad} */
export async function load({ params, fetch }) { 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(); const note = await request.json();
if(request.status != 200){ if (request.status != 200) {
error(request.status, note.title); error(request.status, note.title);
} }

View File

@@ -14,14 +14,17 @@
content: formData.content, content: formData.content,
}; };
const response = await fetch(`http://localhost:5165/api/note/${note.id}`, { const response = await fetch(
method: "PUT", `http://no08g0o48sc8w0woowwsskos.134.255.231.190.sslip.io/api//note/${note.id}`,
headers: { {
"Content-Type": "application/json", 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) { if (response.ok) {
goto("/"); goto("/");
} else { } else {
@@ -29,13 +32,16 @@
} }
} }
async function deleteNote(){ async function deleteNote() {
const response = await fetch(`http://localhost:5165/api/note/${note.id}`, { const response = await fetch(
method: "DELETE", `http://no08g0o48sc8w0woowwsskos.134.255.231.190.sslip.io/api/note/${note.id}`,
headers: { {
"Content-Type": "application/json", method: "DELETE",
} headers: {
}); "Content-Type": "application/json",
},
},
);
if (response.ok) { if (response.ok) {
goto("/"); goto("/");
@@ -75,7 +81,7 @@
<div class="button-container"> <div class="button-container">
<button class="secondary" on:click={deleteNote}>Notiz Löschen</button> <button class="secondary" on:click={deleteNote}>Notiz Löschen</button>
</div> </div>
<br> <br />
<TimeAgo timestamp={note.createdOn}></TimeAgo> <TimeAgo timestamp={note.createdOn}></TimeAgo>
</div> </div>
@@ -86,7 +92,7 @@
margin-top: 1rem; margin-top: 1rem;
} }
button{ button {
width: 100%; width: 100%;
background-color: rgb(194, 43, 43); background-color: rgb(194, 43, 43);
border-color: rgba(255, 255, 255, 0); border-color: rgba(255, 255, 255, 0);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("noteApi")] [assembly: System.Reflection.AssemblyCompanyAttribute("noteApi")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+08298102fe95f5f078d478e6b1b2775209bca346")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+ab378e7fb5ed0479dda981ab5927cbd15ecc0ee2")]
[assembly: System.Reflection.AssemblyProductAttribute("noteApi")] [assembly: System.Reflection.AssemblyProductAttribute("noteApi")]
[assembly: System.Reflection.AssemblyTitleAttribute("noteApi")] [assembly: System.Reflection.AssemblyTitleAttribute("noteApi")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@@ -1 +1 @@
fd3bf1cfafd4c4e119f0a85836ec89b8421a70c2c50f001a5b3d23672063a45c a58e6b906d0d60ae662ce6aa0e421778fd84f80a9dc462d7a209f73327dc7b9c

Binary file not shown.

Binary file not shown.

View File

@@ -1 +1 @@
{"documents":{"D:\\Programmieren\\CSharp\\NoteApp\\*":"https://raw.githubusercontent.com/kobolol/NoteApp/621df92b2770f4f5c3ec45914374ae7a686cb4e4/*"}} {"documents":{"D:\\Programmieren\\CSharp\\NoteApp\\*":"https://raw.githubusercontent.com/kobolol/NoteApp/ab378e7fb5ed0479dda981ab5927cbd15ecc0ee2/*"}}