forked from grafana.jool/grafana-jool
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
30 lines
530 B
30 lines
530 B
const axios = require('axios');
|
|
|
|
export function getClient(options) {
|
|
return axios.create({
|
|
baseURL: 'http://localhost:3000',
|
|
timeout: 1000,
|
|
auth: {
|
|
username: options.username,
|
|
password: options.password,
|
|
},
|
|
});
|
|
}
|
|
|
|
export function getAdminClient() {
|
|
return getClient({
|
|
username: 'admin',
|
|
password: 'admin',
|
|
});
|
|
}
|
|
|
|
let client = getAdminClient();
|
|
|
|
client.callAs = function (user) {
|
|
return getClient({
|
|
username: user.login,
|
|
password: 'password',
|
|
});
|
|
};
|
|
|
|
export default client;
|
|
|