Skip to content

Commit

Permalink
Merge pull request #258 from oarepo/helpers-for-async-requests
Browse files Browse the repository at this point in the history
added helpers for making api calls
  • Loading branch information
mirekys authored Nov 27, 2024
2 parents 84c3779 + f45b11f commit 67ba9f5
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ jobs:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
python-version: "3.12"
- name: Cache pip
uses: actions/cache@v4
with:
Expand Down
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
Expand Up @@ -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",
Expand All @@ -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));
Expand Down

0 comments on commit 67ba9f5

Please sign in to comment.