mirror of
https://github.com/ansible/awx.git
synced 2026-02-03 10:38:15 -03:30
Address PR review comments.
This commit is contained in:
@@ -81,7 +81,7 @@ class App extends React.Component {
|
||||
}
|
||||
|
||||
onDevLogout = async () => {
|
||||
await api.BaseGet(API_LOGOUT);
|
||||
await api.get(API_LOGOUT);
|
||||
this.setState({ activeGroup: 'views_group', activeItem: 'views_group_dashboard' });
|
||||
}
|
||||
|
||||
|
||||
10
src/api.js
10
src/api.js
@@ -1,6 +1,6 @@
|
||||
import axios from 'axios';
|
||||
|
||||
import * as constant from './endpoints';
|
||||
import * as endpoints from './endpoints';
|
||||
|
||||
const CSRF_COOKIE_NAME = 'csrftoken';
|
||||
const CSRF_HEADER_NAME = 'X-CSRFToken';
|
||||
@@ -32,7 +32,7 @@ class APIClient {
|
||||
return authenticated;
|
||||
}
|
||||
|
||||
async login (username, password, redirect = constant.API_CONFIG) {
|
||||
async login (username, password, redirect = endpoints.API_CONFIG) {
|
||||
const un = encodeURIComponent(username);
|
||||
const pw = encodeURIComponent(password);
|
||||
const next = encodeURIComponent(redirect);
|
||||
@@ -40,11 +40,11 @@ class APIClient {
|
||||
const data = `username=${un}&password=${pw}&next=${next}`;
|
||||
const headers = { 'Content-Type': LOGIN_CONTENT_TYPE };
|
||||
|
||||
await this.http.get(constant.API_LOGIN, { headers });
|
||||
await this.http.post(constant.API_LOGIN, data, { headers });
|
||||
await this.http.get(endpoints.API_LOGIN, { headers });
|
||||
await this.http.post(endpoints.API_LOGIN, data, { headers });
|
||||
}
|
||||
|
||||
BaseGet = (endpoint) => this.http.get(endpoint);
|
||||
get = (endpoint) => this.http.get(endpoint);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ import './app.scss';
|
||||
const el = document.getElementById('app');
|
||||
|
||||
const main = async () => {
|
||||
const { custom_logo, custom_login_info } = await api.BaseGet(API_ROOT);
|
||||
const { custom_logo, custom_login_info } = await api.get(API_ROOT);
|
||||
render(<App logo={custom_logo} loginInfo={custom_login_info} />, el);
|
||||
};
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ class Organizations extends Component {
|
||||
}
|
||||
|
||||
async componentDidMount () {
|
||||
const { data } = await api.BaseGet(API_ORGANIZATIONS);
|
||||
const { data } = await api.get(API_ORGANIZATIONS);
|
||||
this.setState({ organizations: data.results });
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user