no cors queries

This commit is contained in:
kurpfish 2021-08-09 11:18:09 +03:00
parent 6e892cb1dc
commit 5880137dd8

View File

@ -3,9 +3,9 @@ export const fetchProfile = async (link, index) => {
const response = await fetch(`${link}${index}`, { const response = await fetch(`${link}${index}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Access-Control-Request-Headers': 'authorization', // 'Access-Control-Request-Headers': 'authorization',
'Authorization': `Bearer ${localStorage.getItem('auth_token')}`, 'Authorization': `Bearer ${localStorage.getItem('auth_token')}`,
'Origin': `${process.env.REACT_APP_BASE_URL}`, // 'Origin': `${process.env.REACT_APP_BASE_URL}`,
} }
}) })
let data = await response.json() let data = await response.json()
@ -19,9 +19,9 @@ export const fetchSkills = async (link) => {
const response = await fetch(link, { const response = await fetch(link, {
method: 'GET', method: 'GET',
headers: { headers: {
'Access-Control-Request-Headers': 'authorization', // 'Access-Control-Request-Headers': 'authorization',
'Authorization': `Bearer ${localStorage.getItem('auth_token')}`, 'Authorization': `Bearer ${localStorage.getItem('auth_token')}`,
'Origin': `${process.env.REACT_APP_BASE_URL}`, // 'Origin': `${process.env.REACT_APP_BASE_URL}`,
} }
}) })
let data = await response.json() let data = await response.json()
@ -36,9 +36,9 @@ export const fetchItemsForId = async (link, id) => {
const response = await fetch(`${link}${id}`, { const response = await fetch(`${link}${id}`, {
method: 'GET', method: 'GET',
headers: { headers: {
'Access-Control-Request-Headers': 'authorization', // 'Access-Control-Request-Headers': 'authorization',
'Authorization': `Bearer ${localStorage.getItem('auth_token')}`, 'Authorization': `Bearer ${localStorage.getItem('auth_token')}`,
'Origin': `${process.env.REACT_APP_BASE_URL}`, // 'Origin': `${process.env.REACT_APP_BASE_URL}`,
} }
}) })
let data = await response.json() let data = await response.json()
@ -52,9 +52,9 @@ export const fetchForm = async (link, info) => {
const response = await fetch(link, { const response = await fetch(link, {
method: 'POST', method: 'POST',
headers: { headers: {
'Access-Control-Request-Headers': 'authorization', // 'Access-Control-Request-Headers': 'authorization',
'Authorization': `Bearer ${localStorage.getItem('auth_token')}`, 'Authorization': `Bearer ${localStorage.getItem('auth_token')}`,
'Origin': `${process.env.REACT_APP_BASE_URL}`, // 'Origin': `${process.env.REACT_APP_BASE_URL}`,
'Content-Type': 'multipart/form-data' 'Content-Type': 'multipart/form-data'
}, },
body: info body: info
@ -74,7 +74,7 @@ export const fetchAuth = async ({ username, password, dispatch }) => {
method: 'POST', method: 'POST',
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
'Origin': `${baseURL}`, // 'Origin': `${baseURL}`,
}, },
body: JSON.stringify({ body: JSON.stringify({
username, username,