path is an argument

This commit is contained in:
Adam 2024-01-18 17:39:20 -05:00
parent 7a98b2c3c4
commit 483d7eea1d

View file

@ -10,11 +10,10 @@ pub struct ArticleData {
}
#[server]
pub async fn slingshot() -> Result<Vec<ArticleData>, ServerFnError> {
pub async fn slingshot(path: String) -> Result<Vec<ArticleData>, ServerFnError> {
let mut articles = vec![];
let data_dir = "./pubic/static";
for dir in std::fs::read_dir(data_dir)? {
for dir in std::fs::read_dir(path)? {
for file in std::fs::read_dir(dir?.path())? {
let fileinfo = file?;
let filepath = fileinfo.path();