update cases

This commit is contained in:
AceDataCloud committed 2023-01-21 15:44:16 +08:00
1 parent 983dff4ab3
commit 668c2b3a6b
11 files changed
+27 -38

No files matched your search

+2 -2
View File
@@ -19,14 +19,14 @@
</div>
<div class="key">
<span class="label">{{ $t('application.field.apiKey') }}</span>
<span class="value">{{ application.apiKey }}</span>
<span class="value">{{ application.api_key }}</span>
<span class="copy">
<font-awesome-icon icon="fa-regular fa-copy" />
</span>
</div>
<div class="remaining-count">
<span class="label">{{ $t('application.field.remainingCount') }}</span>
<span class="value">{{ application.remainingCount }}</span>
<span class="value">{{ application.remaining_count }}</span>
</div>
<div class="links">
<div class="link">
+3 -3
View File
@@ -3,14 +3,14 @@
<el-collapse-item v-for="(response, responseKey) in responses" :key="responseKey" class="item" :name="responseKey">
<template #title>
<span class="badge">
<el-tag v-if="response.isSuccess" class="ml-2" type="success">{{ $t('api.entity.success') }}</el-tag>
<el-tag v-if="response.is_success" class="ml-2" type="success">{{ $t('api.entity.success') }}</el-tag>
<el-tag v-else class="ml-2" type="danger">{{ $t('api.entity.failure') }}</el-tag>
</span>
<span class="status-code">
{{ response.statusCode }}
{{ response.status_code }}
</span>
<span class="error-code">
{{ response.errorCode }}
{{ response.error_code }}
</span>
</template>
<div class="item-body">
+6 -6
View File
@@ -33,9 +33,9 @@ export interface IResponse {
title: string;
description?: string;
example?: string;
isSuccess: boolean;
errorCode?: string;
statusCode: number;
is_success: boolean;
error_code?: string;
status_code: number;
body: ISchema;
headers: ISchema;
}
@@ -50,10 +50,10 @@ export interface IApi {
tags?: string[];
request: IRequest;
responses: IResponse[];
isFree?: boolean;
is_free?: boolean;
service?: string;
createdAt?: string;
updatedAt?: string;
created_at?: string;
updated_at?: string;
}
export interface IApiListResponse {
+1 -2
View File
@@ -1,5 +1,4 @@
import { AxiosResponse } from 'axios';
import { decamelizeKeys } from 'humps';
import { httpClient } from '../instance';
import { IApi, IApiDetailResponse, IApiListResponse } from '../api/models';
@@ -13,7 +12,7 @@ class ApiOperator {
async getAll(query: IApiQuery): Promise<AxiosResponse<IApiListResponse>> {
return await httpClient.get(`/${this.key}/`, {
params: decamelizeKeys(query)
params: query
});
}
+6 -6
View File
@@ -1,12 +1,12 @@
export interface IApplication {
id?: string;
service: string;
apiKey?: string;
userId?: string;
remainingCount?: number;
usedCount?: number;
createdAt?: string;
updatedAt?: string;
api_key?: string;
user_id?: string;
remaining_count?: number;
used_count?: number;
created_at?: string;
updated_at?: string;
}
export interface IApplicationListResponse {
+2 -3
View File
@@ -1,10 +1,9 @@
import { AxiosResponse } from 'axios';
import { httpClient } from '../instance';
import { IApplication, IApplicationDetailResponse, IApplicationListResponse } from './models';
import { camelizeKeys, decamelizeKeys } from 'humps';
export interface IApplicationQuery {
userId: string;
user_id: string;
}
class ApplicationOperator {
@@ -12,7 +11,7 @@ class ApplicationOperator {
async getAll(query: IApplicationQuery): Promise<AxiosResponse<IApplicationListResponse>> {
return await httpClient.get(`/${this.key}/`, {
params: decamelizeKeys(query)
params: query
});
}
+1 -10
View File
@@ -1,7 +1,6 @@
import router from '@/router';
import store from '@/store';
import axios, { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
import { camelizeKeys, decamelizeKeys } from 'humps';
import axios, { AxiosInstance } from 'axios';
import { getCookie } from 'typescript-cookie';
const httpClient: AxiosInstance = axios.create({
@@ -17,17 +16,11 @@ httpClient.interceptors.request.use((config) => {
if (accessToken) {
config.headers['Authorization'] = `Bearer ${accessToken}`;
}
if (config.data) {
config.data = decamelizeKeys(config.data);
}
return config;
});
httpClient.interceptors.response.use(
(response) => {
if (response.data && response.headers['content-type'] === 'application/json') {
response.data = camelizeKeys(response.data);
}
return response;
},
(error) => {
@@ -39,6 +32,4 @@ httpClient.interceptors.response.use(
}
);
// const httpClient = (options: AxiosRequestConfig): Promise<AxiosResponse> => instance.request(options);
export { httpClient };
+3 -3
View File
@@ -6,10 +6,10 @@ export interface IService {
thumbnail?: string;
icon?: string;
price?: number;
appliedCount: number;
applied_count: number;
introduction: string;
createdAt?: string;
updatedAt?: string;
created_at?: string;
updated_at?: string;
}
export interface IServiceListResponse {
+1 -1
View File
@@ -13,7 +13,7 @@ class ServiceOperator {
async getAll(query: IServiceQuery): Promise<AxiosResponse<IServiceListResponse>> {
return await httpClient.get(`/${this.key}/`, {
params: decamelizeKeys(query)
params: query
});
}
+1 -1
View File
@@ -41,7 +41,7 @@ export default defineComponent({
this.loading = true;
applicationOperator
.getAll({
userId: this.$store.getters.user.id
user_id: this.$store.getters.user.id
})
.then(({ data: data }: { data: IApplicationListResponse }) => {
this.applications = data.items;
+1 -1
View File
@@ -37,7 +37,7 @@
<font-awesome-icon :icon="'fa-regular fa-' + service.icon" />
</div>
<div class="count">
<p>{{ $t('service.message.appliedCount') }}: {{ service.appliedCount }}</p>
<p>{{ $t('service.message.appliedCount') }}: {{ service.applied_count }}</p>
</div>
</div>
<div class="right">