|
@ -612,7 +612,7 @@ |
|
|
</template> |
|
|
</template> |
|
|
|
|
|
|
|
|
<script lang="ts"> |
|
|
<script lang="ts"> |
|
|
import { AxiosError, AxiosRequestConfig } from "axios"; |
|
|
import { AxiosError } from "axios"; |
|
|
import Dexie from "dexie"; |
|
|
import Dexie from "dexie"; |
|
|
import "dexie-export-import"; |
|
|
import "dexie-export-import"; |
|
|
import { ImportProgress } from "dexie-export-import/dist/import"; |
|
|
import { ImportProgress } from "dexie-export-import/dist/import"; |
|
@ -637,6 +637,8 @@ import { |
|
|
ErrorResponse, |
|
|
ErrorResponse, |
|
|
EndorserRateLimits, |
|
|
EndorserRateLimits, |
|
|
ImageRateLimits, |
|
|
ImageRateLimits, |
|
|
|
|
|
fetchEndorserRateLimits, |
|
|
|
|
|
fetchImageRateLimits, |
|
|
} from "@/libs/endorserServer"; |
|
|
} from "@/libs/endorserServer"; |
|
|
import { Buffer } from "buffer/"; |
|
|
import { Buffer } from "buffer/"; |
|
|
import EntityIcon from "@/components/EntityIcon.vue"; |
|
|
import EntityIcon from "@/components/EntityIcon.vue"; |
|
@ -1202,7 +1204,11 @@ export default class AccountViewView extends Vue { |
|
|
this.limitsMessage = ""; |
|
|
this.limitsMessage = ""; |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
const resp = await this.fetchEndorserRateLimits(identity); |
|
|
const resp = await fetchEndorserRateLimits( |
|
|
|
|
|
this.apiServer, |
|
|
|
|
|
this.axios, |
|
|
|
|
|
identity, |
|
|
|
|
|
); |
|
|
if (resp.status === 200) { |
|
|
if (resp.status === 200) { |
|
|
this.endorserLimits = resp.data; |
|
|
this.endorserLimits = resp.data; |
|
|
if (!this.isRegistered) { |
|
|
if (!this.isRegistered) { |
|
@ -1226,7 +1232,11 @@ export default class AccountViewView extends Vue { |
|
|
); |
|
|
); |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
const imageResp = await this.fetchImageRateLimits(identity); |
|
|
const imageResp = await fetchImageRateLimits( |
|
|
|
|
|
this.apiServer, |
|
|
|
|
|
this.axios, |
|
|
|
|
|
identity, |
|
|
|
|
|
); |
|
|
if (imageResp.status === 200) { |
|
|
if (imageResp.status === 200) { |
|
|
this.imageLimits = imageResp.data; |
|
|
this.imageLimits = imageResp.data; |
|
|
} |
|
|
} |
|
@ -1249,30 +1259,6 @@ export default class AccountViewView extends Vue { |
|
|
this.loadingLimits = false; |
|
|
this.loadingLimits = false; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Fetches rate limits from the Endorser server. |
|
|
|
|
|
* |
|
|
|
|
|
* @param {IIdentifier} identity - The identity object to check rate limits for. |
|
|
|
|
|
* @returns {Promise<AxiosResponse>} The Axios response object. |
|
|
|
|
|
*/ |
|
|
|
|
|
private async fetchEndorserRateLimits(identity: IIdentifier) { |
|
|
|
|
|
const url = `${this.apiServer}/api/report/rateLimits`; |
|
|
|
|
|
const headers = await this.getHeaders(identity); |
|
|
|
|
|
return await this.axios.get(url, { headers } as AxiosRequestConfig); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
|
* Fetches rate limits from the image server. |
|
|
|
|
|
* |
|
|
|
|
|
* @param {IIdentifier} identity - The identity object to check rate limits for. |
|
|
|
|
|
* @returns {Promise<AxiosResponse>} The Axios response object. |
|
|
|
|
|
*/ |
|
|
|
|
|
private async fetchImageRateLimits(identity: IIdentifier) { |
|
|
|
|
|
const url = DEFAULT_IMAGE_API_SERVER + "/image-limits"; |
|
|
|
|
|
const headers = await this.getHeaders(identity); |
|
|
|
|
|
return await this.axios.get(url, { headers } as AxiosRequestConfig); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
/** |
|
|
* Handles errors that occur while fetching rate limits. |
|
|
* Handles errors that occur while fetching rate limits. |
|
|
* |
|
|
* |
|
|