mirror of
https://github.com/mayswind/ezbookkeeping.git
synced 2026-05-14 15:07:33 +08:00
code refactor
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
const baseUrlPath = '/api';
|
||||
|
||||
export default {
|
||||
baseUrlPath: baseUrlPath
|
||||
}
|
||||
+2
-7
@@ -1,13 +1,12 @@
|
||||
import axios from 'axios';
|
||||
|
||||
import api from "../consts/api.js";
|
||||
import userState from "./userstate.js";
|
||||
|
||||
const baseUrlPath = '/api';
|
||||
|
||||
let needBlockRequest = false;
|
||||
let blockedRequests = [];
|
||||
|
||||
axios.defaults.baseURL = baseUrlPath;
|
||||
axios.defaults.baseURL = api.baseUrlPath;
|
||||
axios.interceptors.request.use(config => {
|
||||
const token = userState.getToken();
|
||||
|
||||
@@ -113,10 +112,6 @@ export default {
|
||||
});
|
||||
});
|
||||
},
|
||||
getDataExportUrl: () => {
|
||||
const token = userState.getToken();
|
||||
return `${baseUrlPath}/data/export.csv?token=${token}`;
|
||||
},
|
||||
getTokens: () => {
|
||||
return axios.get('v1/tokens/list.json');
|
||||
},
|
||||
|
||||
@@ -16,6 +16,7 @@ import 'framework7-icons';
|
||||
import 'line-awesome/dist/line-awesome/css/line-awesome.css';
|
||||
|
||||
import { getAllLanguages, getLanguage, getDefaultLanguage, getI18nOptions, getLocalizedError, getLocalizedErrorParameters } from './lib/i18n.js';
|
||||
import api from './consts/api.js';
|
||||
import currency from './consts/currency.js';
|
||||
import colors from './consts/color.js';
|
||||
import icons from './consts/icon.js';
|
||||
@@ -82,6 +83,7 @@ Vue.prototype.$buildTime = version.getBuildTime();
|
||||
|
||||
Vue.prototype.$licenses = licenses;
|
||||
Vue.prototype.$constants = {
|
||||
api: api,
|
||||
currency: currency,
|
||||
colors: colors,
|
||||
icons: icons,
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
<f7-card>
|
||||
<f7-card-content class="no-safe-areas" :padding="false">
|
||||
<f7-list>
|
||||
<f7-list-button external no-chevron target="_blank" :link="$services.getDataExportUrl()">{{ $t('Export Data') }}</f7-list-button>
|
||||
<f7-list-button external no-chevron target="_blank" :link="`${$constants.api.baseUrlPath}/data/export.csv?token=${$user.getToken()}`">{{ $t('Export Data') }}</f7-list-button>
|
||||
</f7-list>
|
||||
</f7-card-content>
|
||||
</f7-card>
|
||||
|
||||
Reference in New Issue
Block a user