feat: ts定义

This commit is contained in:
neo 2024-12-14 21:11:25 +08:00
parent 27cc7c4d21
commit f38a1a806e
5 changed files with 16 additions and 4 deletions

View File

@ -72,7 +72,7 @@ const AppDetail = ({}) => {
const getCaskDetail = id => {
fetch(
'http://localhost:8000/homebrew/cask-detail?' +
AVALON_SERVER + '/homebrew/cask-detail?' +
queryString.stringify({
id,
}),
@ -92,7 +92,7 @@ const AppDetail = ({}) => {
const getFormulaDetail = id => {
fetch(
'http://localhost:8000/homebrew/formula-detail?' +
AVALON_SERVER + '/homebrew/formula-detail?' +
queryString.stringify({
id,
}),

View File

@ -47,7 +47,7 @@ const CaskAndFormula = ({}) => {
const getCaskList = () => {
fetch(
'http://localhost:8000/homebrew/cask-list?' +
AVALON_SERVER + '/homebrew/cask-list?' +
queryString.stringify(listParams),
)
.then(response => response.json())
@ -60,7 +60,7 @@ const CaskAndFormula = ({}) => {
const getFormula = () => {
fetch(
'http://localhost:8000/homebrew/formula-list?' +
AVALON_SERVER + '/homebrew/formula-list?' +
queryString.stringify(listParams),
)
.then(response => response.json())

View File

@ -4,6 +4,9 @@ export default defineConfig({
title: 'Homebrew 中文网',
mode: 'site',
logo: '/images/homebrew-256x256.png',
define: {
'AVALON_SERVER': process.env.NODE_ENV === 'production' ? 'https://avalon.idayer.com' : 'http://localhost:8000',
},
favicon: '/favicon.ico',
locales: [['zh-CN', '中文']],
metas: [],

View File

@ -15,6 +15,7 @@
},
"allowSyntheticDefaultImports": true
},
"include": ["./global.d.ts"],
"exclude": [
"node_modules",
"lib",

8
typings.d.ts vendored
View File

@ -1,2 +1,10 @@
declare module '*.css';
declare module '*.less';
declare var AVALON_SERVER: string
declare global {
var AVALON_SERVER: string
}
export {}