forked from trent_larson/crowd-funder-for-time-pwa
constantly recheck on home screen if not registered
This commit is contained in:
@@ -612,7 +612,7 @@
|
||||
</template>
|
||||
|
||||
<script lang="ts">
|
||||
import { AxiosError, AxiosRequestConfig } from "axios";
|
||||
import { AxiosError } from "axios";
|
||||
import Dexie from "dexie";
|
||||
import "dexie-export-import";
|
||||
import { ImportProgress } from "dexie-export-import/dist/import";
|
||||
@@ -637,6 +637,8 @@ import {
|
||||
ErrorResponse,
|
||||
EndorserRateLimits,
|
||||
ImageRateLimits,
|
||||
fetchEndorserRateLimits,
|
||||
fetchImageRateLimits,
|
||||
} from "@/libs/endorserServer";
|
||||
import { Buffer } from "buffer/";
|
||||
import EntityIcon from "@/components/EntityIcon.vue";
|
||||
@@ -1202,7 +1204,11 @@ export default class AccountViewView extends Vue {
|
||||
this.limitsMessage = "";
|
||||
|
||||
try {
|
||||
const resp = await this.fetchEndorserRateLimits(identity);
|
||||
const resp = await fetchEndorserRateLimits(
|
||||
this.apiServer,
|
||||
this.axios,
|
||||
identity,
|
||||
);
|
||||
if (resp.status === 200) {
|
||||
this.endorserLimits = resp.data;
|
||||
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) {
|
||||
this.imageLimits = imageResp.data;
|
||||
}
|
||||
@@ -1249,30 +1259,6 @@ export default class AccountViewView extends Vue {
|
||||
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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user