Skip to content

Commit

Permalink
added helpers for making api calls
Browse files Browse the repository at this point in the history
Ducica committed Nov 25, 2024
1 parent 2d97372 commit f15b371
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions oarepo_ui/theme/assets/semantic-ui/js/oarepo_ui/util.js
Original file line number Diff line number Diff line change
@@ -276,7 +276,17 @@ export const goBack = (fallBackURL = "/") => {
};

// until we start using v4 of react-invenio-forms. They switched to vnd zenodo accept header
const baseAxiosConfiguration = {
const baseAxiosConfigurationApplicationJson = {
withCredentials: true,
xsrfCookieName: "csrftoken",
xsrfHeaderName: "X-CSRFToken",
headers: {
Accept: "application/json",
"Content-Type": "application/json",
},
};

const baseAxiosConfigurationVnd = {
withCredentials: true,
xsrfCookieName: "csrftoken",
xsrfHeaderName: "X-CSRFToken",
@@ -286,7 +296,11 @@ const baseAxiosConfiguration = {
},
};

export const http = axios.create(baseAxiosConfiguration);
export const httpApplicationJson = axios.create(
baseAxiosConfigurationApplicationJson
);

export const httpVnd = axios.create(baseAxiosConfigurationVnd);

export const encodeUnicodeBase64 = (str) => {
return btoa(encodeURIComponent(str));
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = oarepo-ui
version = 5.2.26
version = 5.2.27
description = UI module for invenio 3.5+
long_description = file: README.md
long_description_content_type = text/markdown

0 comments on commit f15b371

Please sign in to comment.