Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930
  1. import { API_ENDPOINT } from "./endpointDef";
  2. import apiEndpoints from "./apiEndpoints";
  3. export const postsApi = async (jwt) => {
  4. const result = await fetch(`${API_ENDPOINT}${apiEndpoints.fetchPosts}`, {
  5. method: "GET",
  6. headers: {
  7. "Content-Type": "application/json",
  8. 'Authorization': "Bearer " + jwt,
  9. },
  10. });
  11. const res = await result.json();
  12. return res;
  13. };
  14. export const singlePostApi = async (jwt, postId) => {
  15. const result = await fetch(`${API_ENDPOINT}api/posts/${postId}?populate=*`, {
  16. method: "GET",
  17. headers: {
  18. "Content-Type": "application/json",
  19. 'Authorization': "Bearer " + jwt,
  20. },
  21. });
  22. const res = await result.json();
  23. return res;
  24. };