mirror of
https://github.com/ansible/awx.git
synced 2026-02-26 23:46:05 -03:30
Address PR review comments.
This commit is contained in:
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);
|
||||
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user