Merge pull request #2007 from influxdata/fix/authorizations-response
Match shape of get/authorizations to backend responsepull/10616/head
commit
d9e9b1fd85
|
@ -3666,7 +3666,7 @@ components:
|
|||
links:
|
||||
readOnly: true
|
||||
$ref: "#/components/schemas/Links"
|
||||
auths:
|
||||
authorizations:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/Authorization"
|
||||
|
|
|
@ -417,7 +417,7 @@ export const createTelegrafConfigResponse = {
|
|||
export const authResponse = {
|
||||
data: {
|
||||
links: {self: '/api/v2/authorizations'},
|
||||
auths: [
|
||||
authorizations: [
|
||||
{
|
||||
links: {
|
||||
self: '/api/v2/authorizations/030358b6aa718000',
|
||||
|
|
|
@ -171,7 +171,7 @@ export interface Authorizations {
|
|||
* @type {Array<Authorization>}
|
||||
* @memberof Authorizations
|
||||
*/
|
||||
auths?: Array<Authorization>;
|
||||
authorizations?: Array<Authorization>;
|
||||
/**
|
||||
*
|
||||
* @type {Links}
|
||||
|
|
|
@ -4,7 +4,7 @@ import {AxiosResponse} from 'axios'
|
|||
|
||||
export const getAuthorizations = async (): Promise<Authorization[]> => {
|
||||
const {data} = await authorizationsAPI.authorizationsGet()
|
||||
return data.auths
|
||||
return data.authorizations
|
||||
}
|
||||
|
||||
export const deleteAuthorization = async (
|
||||
|
|
|
@ -93,7 +93,7 @@ export const getAuthorizationToken = async (
|
|||
): Promise<string> => {
|
||||
try {
|
||||
const data = await authorizationsAPI.authorizationsGet(undefined, username)
|
||||
return getDeep<string>(data, 'data.auths.0.token', '')
|
||||
return getDeep<string>(data, 'data.authorizations.0.token', '')
|
||||
} catch (error) {
|
||||
console.error(error)
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue