แก้ 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 {
|
||||
//Get
|
||||
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;
|
||||
try {
|
||||
const response = await axios.get(url, {
|
||||
|
|
@ -54,7 +54,7 @@ class CallAPI {
|
|||
}
|
||||
//Post
|
||||
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;
|
||||
try {
|
||||
const response = await axios.post(url, sendData, {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue