adam boukhris
adam boukhris
Explore posts from servers
PPrisma
Created by adam boukhris on 1/4/2025 in #help-and-questions
Sveltekit not receiving real-time data
I made some researchs and i found that i have to write sql for this , but i'm using prisma DB so i don't have this access
6 replies
PPrisma
Created by adam boukhris on 1/4/2025 in #help-and-questions
Sveltekit not receiving real-time data
i didnt find how in the settings , also when i created a new project it worked for a short period then stopped , even with Replication slot status Unavailable
6 replies
PPrisma
Created by adam boukhris on 1/4/2025 in #help-and-questions
Sveltekit not receiving real-time data
what do you mean by re-enable the replication
6 replies
PPrisma
Created by adam boukhris on 1/4/2025 in #help-and-questions
Sveltekit not receiving real-time data
//+page.svelte
<script>
import { onMount } from "svelte";
export let data;
let { links } = data;

onMount(() => {
const eventSource = new EventSource("/api");

eventSource.onmessage = (event) => {
console.log("SSE message received:", event.data);
const eventData = JSON.parse(event.data);

switch (eventData.action) {
case "create":
links = [...links, eventData.created];
break;
case "update":
links = links.map((link) =>
link.id === eventData.updated.id ? eventData.updated : link
);
break;
case "delete":
links = links.filter((link) => link.id !== eventData.deleted.id);
break;
}
};

eventSource.onerror = (error) => {
console.error("SSE error:", error);
};

return () => {
eventSource.close();
};
});
const delet = async (id) => {
const response = await fetch(`/api/delete/${id}`, {
method: "DELETE",
});

if (response.ok) {
links = links.filter((link) => link.id !== id);
}
};
</script>
//+page.svelte
<script>
import { onMount } from "svelte";
export let data;
let { links } = data;

onMount(() => {
const eventSource = new EventSource("/api");

eventSource.onmessage = (event) => {
console.log("SSE message received:", event.data);
const eventData = JSON.parse(event.data);

switch (eventData.action) {
case "create":
links = [...links, eventData.created];
break;
case "update":
links = links.map((link) =>
link.id === eventData.updated.id ? eventData.updated : link
);
break;
case "delete":
links = links.filter((link) => link.id !== eventData.deleted.id);
break;
}
};

eventSource.onerror = (error) => {
console.error("SSE error:", error);
};

return () => {
eventSource.close();
};
});
const delet = async (id) => {
const response = await fetch(`/api/delete/${id}`, {
method: "DELETE",
});

if (response.ok) {
links = links.filter((link) => link.id !== id);
}
};
</script>
6 replies
PPrisma
Created by adam boukhris on 6/8/2024 in #help-and-questions
problem when deploying prisma
you are right , i found that there is a part of the project that uses Lucia auth i forgot to delete it , it's the source of this error
8 replies
PPrisma
Created by adam boukhris on 6/8/2024 in #help-and-questions
problem when deploying prisma
The problem happened in my original project, and when i found people talking about the error i found that they are using Prisma, so i tryied to make the same project without prisma , it worked correctly , but when i added prisma it happened
8 replies
PPrisma
Created by RYTRO on 6/7/2024 in #help-and-questions
Vulnerabilities That Won't Be Fixed
Also try without the --save-dev
18 replies
PPrisma
Created by RYTRO on 6/7/2024 in #help-and-questions
Vulnerabilities That Won't Be Fixed
Did you try to ask gpt?
18 replies
PPrisma
Created by RYTRO on 6/7/2024 in #help-and-questions
Vulnerabilities That Won't Be Fixed
What node -v are you using ?
18 replies