inspireui / beonews

5 stars 0 forks source link

Change default Homepage app info #30

Open hackertuga opened 6 years ago

hackertuga commented 6 years ago

Hi guys, amazing work that you did here!

I successfully configured your app with my wp site and did some code changes!

Now I want to change the default app homepage info: I no longer want the info from /wp-json/wp/v2/posts, but from /wp-json/wp/v2/foodporns, how can I easily achieve this? my website is this one

Kind regards

(my purchase code is: edfa3443-7885-4693-b14b-544965b73ef7)

inspireui commented 6 years ago

Hi, you can change the files Redux/actions/PostActions.js which is used to fetch the post data, in oder to change the request URL you can refer the the services/WordpressAPI.js and replace the request method

Example:

let api = wp.posts() .tags(tags) .categories(categories).excludeCategories(Config.excludeCategories) .perPage(limit) .page(page) .sticky(sticky);

could be replace by implementing new function inside WodpressAPI:

WordpressAPI.prototype.getPosts = function () { var requestUrl = this.url + ' /wp-json/wp/v2/foodporns'; return this._request(requestUrl); };

hackertuga commented 6 years ago

Before your answer I did the changes in WordpressAPI.js. But I still don't understand what should I call on redux. I added: import test from "@services/WordpressApi"; and rewrote let api to let api = test.getPosts();, a I get that is a function not defined(?!)

hackertuga commented 6 years ago

Hi, can you please give some update on this? I did all the navigations, style, menu changes and I'm stuck on this, since I never used redux library/state container. What should I do in PostActions.js? thanks!

inspireui commented 6 years ago

could you share that file here so we can have a check ?

hackertuga commented 6 years ago

PostActions.js.zip

here it is. thanks!