gatsby-core-theme 44.4.9 → 44.4.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [44.4.10](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.4.9...v44.4.10) (2025-07-15)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * added axios to requests ([56d8110](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/commit/56d81105fcff189355cb05286e218fc23362af58))
7
+
1
8
  ## [44.4.9](https://gitlab.com/g2m-gentoo/team-floyd/themes/gatsby-themes/compare/v44.4.8...v44.4.9) (2025-07-15)
2
9
 
3
10
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "gatsby-core-theme",
3
- "version": "44.4.9",
3
+ "version": "44.4.10",
4
4
  "description": "Gatsby Theme NPM Package",
5
5
  "author": "",
6
6
  "license": "ISC",
@@ -3,6 +3,7 @@
3
3
  /* eslint-disable jsx-a11y/click-events-have-key-events */
4
4
  /* eslint-disable import/no-extraneous-dependencies */
5
5
  import React from 'react';
6
+ import axios from 'axios';
6
7
  import PropTypes from 'prop-types';
7
8
  import LazyImage from '~hooks/lazy-image';
8
9
 
@@ -24,27 +25,23 @@ const Comment = ({ comment, authors, isReply }) => {
24
25
  const handleVote = async (like = false, commentId) => {
25
26
  const data = like ? {"vote_up": "increase"} : {"vote_down": "increase"};
26
27
 
27
- try{
28
- const res = await fetch(
29
- `${process.env.GATSBY_API_URL_V2}/content/v0.1/comments/votes/${commentId}`,
30
- {
31
- method: 'PUT',
32
- cache: 'no-cache',
33
- headers: {
34
- 'Content-Type': 'application/json',
35
- "X-ID": process.env.GATSBY_API_V2_X_ID,
36
- "X-Signature": process.env.GATSBY_API_V2_X_SIGNATURE,
37
- },
38
- body: JSON.stringify(data),
39
- }
40
- );
28
+ const headers = {
29
+ headers: {
30
+ "X-ID": process.env.GATSBY_API_V2_X_ID,
31
+ "X-Signature": process.env.GATSBY_API_V2_X_SIGNATURE,
32
+ "Content-Type": "application/json",
33
+ Accept: "application/json",
34
+ },
35
+ };
41
36
 
42
- if (!res.ok) {
43
- throw new Error(`Vote failed with status ${res.status}`);
44
- }
45
- }catch(error){
46
- console.log(error, `${process.env.GATSBY_API_URL}/v0.1/content/comments/votes/${commentId}`);
47
- }
37
+ const path = `${process.env.GATSBY_API_URL_V2}/content/v0.1/comments/votes/${commentId}`;
38
+
39
+ return new Promise((resolve, reject) => {
40
+ axios
41
+ .post(path, data, headers)
42
+ .then((response) => resolve(response.data.result))
43
+ .catch((error) => reject(error?.response?.data?.errors?.join() || error.message));
44
+ });
48
45
  }
49
46
 
50
47
  return <div className={`${styles.commentContainer} ${isReply ? styles.isReply : ''}`}>
@@ -2,7 +2,7 @@
2
2
  /* eslint-disable jsx-a11y/click-events-have-key-events */
3
3
  /* eslint-disable import/no-extraneous-dependencies */
4
4
  import React from 'react';
5
-
5
+ import axios from "axios";
6
6
  import Form from "gatsby-core-theme/src/components/organisms/form";
7
7
  import PropTypes from 'prop-types';
8
8
  import { FaArrowRight } from '@react-icons/all-files/fa/FaArrowRight';
@@ -39,15 +39,20 @@ const LeaveCommentForm = ({
39
39
  delete data?.post_anonymously;
40
40
  delete data?.tnc;
41
41
 
42
- return fetch(submitUrl, {
43
- method: 'POST',
44
- cache: 'no-cache',
45
- headers: {
46
- 'Content-Type': 'application/json',
42
+ const headers = {
43
+ headers: {
47
44
  "X-ID": process.env.GATSBY_API_V2_X_ID,
48
45
  "X-Signature": process.env.GATSBY_API_V2_X_SIGNATURE,
46
+ "Content-Type": "application/json",
47
+ Accept: "application/json",
49
48
  },
50
- body: JSON.stringify(data),
49
+ };
50
+
51
+ return new Promise((resolve, reject) => {
52
+ axios
53
+ .post(submitUrl, data, headers)
54
+ .then((response) => resolve(response.data.result))
55
+ .catch((error) => reject(error?.response?.data?.errors?.join() || error.message));
51
56
  });
52
57
  };
53
58