I’m having trouble with
I am trying to access blog posts from a back end script - eg:
import { Permissions, webMethod } from "wix-web-module";
import { posts } from "wix-blog-backend";
export const getPosts = webMethod(Permissions.Anyone, async () => {
try {
const results = await posts.queryPosts().find();
const items = results.items;
return items;
} catch (error) {
console.error(error);
}
});
But no matter what variation of the back end blog functions I use (ID, Slug, etc), it always returns:
It seems to indicate a permission error. But the backend API is meant to allow me to, as a user, fetch blog posts. All I want to do is get the current blog post that the user is looking at - without connecting it as a dataset.
Working in
Wix Studio, Dev Mode, Blocks Builder
