path is an argument
This commit is contained in:
parent
7a98b2c3c4
commit
483d7eea1d
1 changed files with 2 additions and 3 deletions
|
@ -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();
|
||||
|
|
Loading…
Add table
Reference in a new issue