usermanagement, role, etc
This commit is contained in:
@ -1,18 +1,26 @@
|
||||
import axios from 'axios';
|
||||
import Cookies from "js-cookie";
|
||||
|
||||
const token = Cookies.get(`token`) || null;
|
||||
const headers = {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"content-type":"application/json",
|
||||
};
|
||||
if (token) headers["Authorization"] = `Bearer ${token}`;
|
||||
|
||||
const instance = axios.create({
|
||||
baseURL: 'https://api.telkomcel.tl/tpay-stg-dash-api/',
|
||||
headers: {
|
||||
"Access-Control-Allow-Origin": "*",
|
||||
"content-type":"application/json",
|
||||
},
|
||||
headers: headers
|
||||
})
|
||||
|
||||
export async function fetchApi(path, method, data) {
|
||||
export async function fetchApi(path, method, data, params) {
|
||||
let query = params || {};
|
||||
query.token = token
|
||||
let response = await instance({
|
||||
method: method,
|
||||
url: path,
|
||||
data: data
|
||||
data: data,
|
||||
params: query
|
||||
});
|
||||
return response
|
||||
}
|
||||
Reference in New Issue
Block a user