แก้ call api
This commit is contained in:
parent
0be33a3f3a
commit
f8a91f60ba
1 changed files with 2 additions and 2 deletions
|
|
@ -17,7 +17,7 @@ import { addLogSequence } from "./utils";
|
||||||
class CallAPI {
|
class CallAPI {
|
||||||
//Get
|
//Get
|
||||||
public async GetData(request: any, @Path() path: any) {
|
public async GetData(request: any, @Path() path: any) {
|
||||||
const token = request.headers.authorization;
|
const token = "Bearer " + request.headers.authorization.replace("Bearer ", "");
|
||||||
const url = process.env.API_URL + path;
|
const url = process.env.API_URL + path;
|
||||||
try {
|
try {
|
||||||
const response = await axios.get(url, {
|
const response = await axios.get(url, {
|
||||||
|
|
@ -54,7 +54,7 @@ class CallAPI {
|
||||||
}
|
}
|
||||||
//Post
|
//Post
|
||||||
public async PostData(request: any, @Path() path: any, sendData: any) {
|
public async PostData(request: any, @Path() path: any, sendData: any) {
|
||||||
const token = request.headers.authorization;
|
const token = "Bearer " + request.headers.authorization.replace("Bearer ", "");
|
||||||
const url = process.env.API_URL + path;
|
const url = process.env.API_URL + path;
|
||||||
try {
|
try {
|
||||||
const response = await axios.post(url, sendData, {
|
const response = await axios.post(url, sendData, {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue