refactor: migrate backend to TypeScript
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
// ESLint 检查 .vue 文件需要单独配置编辑器:
|
||||
// https://eslint.vuejs.org/user-guide/#editor-integrations
|
||||
{
|
||||
"extends": ["taro/vue3", "../eslint.base.cjs"],
|
||||
"extends": ["taro/vue3", "../../eslint.base.cjs"],
|
||||
"parser": "vue-eslint-parser",
|
||||
"parserOptions": {
|
||||
"parser": "@typescript-eslint/parser",
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
import type { UserConfigExport } from "@tarojs/cli"
|
||||
|
||||
export default {
|
||||
|
||||
defineConstants: {
|
||||
TARO_APP_API_BASE: JSON.stringify("http://localhost:3000")
|
||||
},
|
||||
mini: {},
|
||||
h5: {}
|
||||
} satisfies UserConfigExport<'vite'>
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"name": "@simple-template/app",
|
||||
"name": "@collab_ledger/app",
|
||||
"version": "1.0.0",
|
||||
"private": true,
|
||||
"description": "simple app",
|
||||
@@ -30,7 +30,7 @@
|
||||
"dev:qq": "pnpm build:qq --watch",
|
||||
"dev:jd": "pnpm build:jd --watch",
|
||||
"dev:harmony-hybrid": "pnpm build:harmony-hybrid --watch",
|
||||
"lint": "eslint --ignore-path ../.eslintignore \"{src,config}/**/*.{vue,js,ts,tsx}\" && pnpm --dir .. exec stylelint \"app/src/**/*.{vue,css,scss}\" --config ./stylelint.config.cjs --ignore-path ./.stylelintignore",
|
||||
"lint": "eslint --ignore-path ../../.eslintignore \"{src,config}/**/*.{vue,js,ts,tsx}\" && pnpm --dir ../.. exec stylelint \"frontend/app/src/**/*.{vue,css,scss}\" --config stylelint.config.cjs --ignore-path .stylelintignore",
|
||||
"typecheck": "tsc --noEmit"
|
||||
},
|
||||
"browserslist": [
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import Taro from '@tarojs/taro'
|
||||
import type { TokenDTO, UserInfoDTO } from '@/api/types'
|
||||
|
||||
const tokenKey = 'simple-todo-app-token'
|
||||
const userKey = 'simple-todo-app-user'
|
||||
const tokenKey = 'collab_ledger_app_token'
|
||||
const userKey = 'collab_ledger_app_user'
|
||||
|
||||
export function getToken() {
|
||||
return Taro.getStorageSync<string>(tokenKey) || ''
|
||||
|
||||
@@ -21,7 +21,7 @@ interface UploadOptions {
|
||||
showLoading?: boolean
|
||||
}
|
||||
|
||||
const baseURL = process.env.TARO_APP_API_BASE || 'http://localhost:8080'
|
||||
const baseURL = process.env.TARO_APP_API_BASE || 'http://localhost:3000'
|
||||
|
||||
export async function request<T>(options: RequestOptions) {
|
||||
if (options.showLoading !== false) {
|
||||
@@ -137,4 +137,3 @@ function handleResponse<T>(data: ResponseData<T>) {
|
||||
}
|
||||
return data
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
{
|
||||
"extends": "../tsconfig.base.json",
|
||||
"extends": "../../tsconfig.base.json",
|
||||
"compilerOptions": {
|
||||
"target": "es2017",
|
||||
"module": "commonjs",
|
||||
|
||||
Reference in New Issue
Block a user