Next.js Discord

Discord Forum

Server actions help

Answered
In&Out posted this in #help-forum
Open in Discord
Hey folks, i have a client component and actions.ts, and if i use a function from actions.ts, thats a server action funcion into the client component, is that insecure, is the function running on client or is everything fine?
Answered by Yi Lon Ma
yea its secure in that context
View full answer

17 Replies

"use client";

import { useEffect, useState } from "react";
import { createPage, fetchPages, updatePageTitle } from "@/components/actions";
server actions are just syntactic sugar on top of normal http post requests
it should follow the same principles as normal http requests
validate the body before using
@Yi Lon Ma validate the body before using
so its not running on server or what?
i dont get you sorry
it runs on the server
so it should be secure?
secure in which context
idk lol, the standards i guess
secure as in querying db, calling other APIs or secure as in "the payload is validated"
querying db and calling api
yea its secure in that context
Answer
"the payload is validated", this is on me yeah?
That part i gotta do myself yeah?
yea
okay thank you