add access token

This commit is contained in:
Nguyễn Hải Dũng 2022-12-20 10:49:41 +07:00
parent 11cec7054b
commit d87ed2c096
14 changed files with 45 additions and 9 deletions

View File

@ -1,4 +1,4 @@
import { login } from 'actions/isLogin';
import { login } from '../../actions/isLogin';
import React, { Component } from 'react';
import "react-datepicker/dist/react-datepicker.css";
import { HOST } from '../../config/index';

View File

@ -59,6 +59,7 @@ class ImportImage extends Component {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': Store.getState().isLogin.access_token,
// 'Authorization': token
},
data: {
@ -129,6 +130,7 @@ class ImportImage extends Component {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': Store.getState().isLogin.access_token,
// 'Authorization': token
},
body: JSON.stringify({ 'image_obj_id_list': [img._id] })

View File

@ -10,6 +10,7 @@ import { HOST } from '../../config/index';
import swal from 'sweetalert';
import { useLocation } from 'react-router-dom';
import { useSelector } from 'react-redux';
import Store from '../../store';
const initialDataPost = {
index: 1,
@ -76,6 +77,7 @@ export default function LabelImage() {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': Store.getState().isLogin.access_token,
// 'Authorization': token,
},
data: dataDel,
@ -119,6 +121,7 @@ export default function LabelImage() {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': Store.getState().isLogin.access_token,
// 'Authorization': token
},
data: data ? data : dataPost,

View File

@ -10,6 +10,7 @@ import { HOST } from '../../config/index';
import swal from 'sweetalert';
import { useLocation } from 'react-router-dom';
import { useSelector } from 'react-redux';
import Store from '../../store';
const initialDataPost = {
index: 1,
@ -74,6 +75,7 @@ export default function ListItem() {
'Accept': 'application/json',
'Content-Type': 'application/json',
// 'Authorization': token,
'Authorization': Store.getState().isLogin.access_token,
},
data: dataDel,
})
@ -117,6 +119,7 @@ export default function ListItem() {
'Accept': 'application/json',
'Content-Type': 'application/json',
// 'Authorization': token
'Authorization': Store.getState().isLogin.access_token,
},
data: data ? data : dataPost,
})

View File

@ -9,6 +9,7 @@ import React, { useEffect, useRef, useState } from 'react';
import { Button, Modal } from 'react-bootstrap';
import swal from 'sweetalert';
import { HOST } from '../../config/index';
import Store from '../../store';
@ -85,6 +86,8 @@ const ModalEditLabel = (props) => {
'Accept': 'application/json',
'Content-Type': 'application/json',
// 'Authorization': token,
'Authorization': Store.getState().isLogin.access_token,
},
data: dataPost,
})
@ -232,6 +235,8 @@ const ModalEditLabel = (props) => {
'Accept': 'application/json',
'Content-Type': 'application/json',
// 'Authorization': token
'Authorization': Store.getState().isLogin.access_token,
},
body: JSON.stringify(dataUploadImg)
})
@ -277,6 +282,8 @@ const ModalEditLabel = (props) => {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': Store.getState().isLogin.access_token,
// 'Authorization': token
},
body: JSON.stringify({

View File

@ -9,6 +9,7 @@ import React, { useEffect, useRef, useState } from 'react';
import { Button, Modal } from 'react-bootstrap';
import swal from 'sweetalert';
import { HOST } from '../../config/index';
import Store from '../../store';
@ -84,6 +85,8 @@ const Modaledit = (props) => {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': Store.getState().isLogin.access_token,
// 'Authorization': token,
},
data: dataPost,
@ -229,6 +232,8 @@ const Modaledit = (props) => {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': Store.getState().isLogin.access_token,
// 'Authorization': token
},
body: JSON.stringify(dataUploadImg)
@ -273,7 +278,7 @@ const Modaledit = (props) => {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
// 'Authorization': token
'Authorization': Store.getState().isLogin.access_token,
},
body: JSON.stringify({
person_obj_id: crrData._id ? crrData._id : "",

View File

@ -3,6 +3,7 @@ import moment from 'moment';
import 'moment/locale/vi';
import React, { Component } from 'react';
import { Button, Modal } from 'react-bootstrap';
import Store from '../../store';
import swal from 'sweetalert';
import { HOST } from '../../config/index';
@ -25,11 +26,11 @@ class ModalEditImg extends Component {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
// 'Authorization': token
'Authorization': Store.getState().isLogin.access_token,
},
body: JSON.stringify({
"origin_name": this.state.valueImg.origin_name,
"obj_id": this.state.valueImg._id
"obj_id": this.state.valueImg._id,
})
}).then((response) => {
return (

View File

@ -5,6 +5,7 @@ import Switch from "react-switch";
import swal from 'sweetalert';
import $ from 'jquery';
import Select from "react-select";
import Store from '../../store';
import { HOST } from '../../config/index';
class ModalRole extends Component {
@ -61,6 +62,7 @@ class ModalRole extends Component {
headers: {
'Content-Type': 'application/json',
// 'Authorization': token
'Authorization': Store.getState().isLogin.access_token,
},
body: JSON.stringify(dataPost)
}).then((response) => {
@ -96,7 +98,7 @@ class ModalRole extends Component {
method: 'POST',
headers: {
'Content-Type': 'application/json',
// 'Authorization': token
'Authorization': Store.getState().isLogin.access_token,
},
body: JSON.stringify(dataPost)
}).then((response) => {
@ -178,6 +180,8 @@ class ModalRole extends Component {
headers: {
'Content-Type': 'application/json',
// 'Authorization': token
'Authorization': Store.getState().isLogin.access_token,
},
}).then((response) => {
return response.json()
@ -196,6 +200,8 @@ class ModalRole extends Component {
headers: {
'Content-Type': 'application/json',
// 'Authorization': token
'Authorization': Store.getState().isLogin.access_token,
},
}).then((response) => {
return response.json()

View File

@ -9,6 +9,7 @@ import LoadingOverlay from 'react-loading-overlay';
import { PulseLoader } from 'react-spinners';
import swal from 'sweetalert';
import { HOST } from '../../config/index';
import Store from '../../store';
const { Dragger } = Upload;
@ -39,7 +40,8 @@ const ModalUpload = (props) => {
.post(`${HOST}/api/files_face_import`, formData, {
headers: {
"X-Requested-With": "XMLHttpRequest",
"Content-Type": "application/x-www-form-urlencoded",
"Content-Type": "application/x-www-form-urlencoded",
'Authorization': Store.getState().isLogin.access_token,
}
})
)

View File

@ -9,6 +9,7 @@ import React, { useEffect, useRef, useState } from 'react';
import { Button, Modal } from 'react-bootstrap';
import swal from 'sweetalert';
import { HOST } from '../../config/index';
import Store from '../../store';
const { Option } = Select;
@ -85,6 +86,7 @@ const ModalUser = (props) => {
'Accept': 'application/json',
'Content-Type': 'application/json',
// 'Authorization': token,
'Authorization': Store.getState().isLogin.access_token,
},
data: dataPost,
})

View File

@ -51,6 +51,7 @@ class Role extends Component {
'Accept': 'application/json',
'Content-Type': 'application/json',
// 'Authorization': token
'Authorization': Store.getState().isLogin.access_token,
},
}).then((response) => {
return response.json()
@ -91,6 +92,7 @@ class Role extends Component {
method: 'DELETE',
headers: {
'Content-Type': 'application/json',
'Authorization': Store.getState().isLogin.access_token,
// 'Authorization': token,
},
}).then((response) => {

View File

@ -135,7 +135,7 @@ class SearchImage extends Component {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': 'Bearer eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJyb2xlcyI6WyJjbGFzc2lmeS9sb2dpbiJdLCJleHAiOjE2NDE5NzQ5NjV9.2F2PAUKjpfjPJKzgvzgCDtyBuTXDRl86EnJJGdYgWTM'
'Authorization': Store.getState().isLogin.access_token,
},
body: JSON.stringify({
encodings: this.state.selectedEncoding,
@ -205,6 +205,7 @@ class SearchImage extends Component {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': Store.getState().isLogin.access_token,
},
body: JSON.stringify({
image: image_base64

View File

@ -12,6 +12,7 @@ import swal from 'sweetalert';
import { useLocation } from 'react-router-dom';
import Switch from "react-switch";
import Select from "react-select";
import Store from '../../store';
import { useSelector } from 'react-redux';
const initialDataPost = {
@ -86,7 +87,7 @@ export default function User() {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
// 'Authorization': token,
'Authorization': Store.getState().isLogin.access_token,
},
})
if (result.data.status === 10000) {
@ -137,7 +138,7 @@ export default function User() {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
// 'Authorization': token
'Authorization': Store.getState().isLogin.access_token,
},
data: data ? data : dataPost,
})

View File

@ -29,6 +29,7 @@ class Header extends Component {
headers: {
'Accept': 'application/json',
'Content-Type': 'application/json',
'Authorization': Store.getState().isLogin.access_token,
},
})
.then(response => {