环境变量
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { addAPIProvider } from "@iconify/vue"
|
||||
import { createPinia } from "pinia"
|
||||
import { createRouter, createWebHistory } from "vue-router"
|
||||
|
||||
@@ -32,3 +33,9 @@ const app = createApp(App)
|
||||
app.use(router)
|
||||
app.use(pinia)
|
||||
app.mount("#app")
|
||||
|
||||
if (!!import.meta.env.VITE_ICONIFY_URL) {
|
||||
addAPIProvider("", {
|
||||
resources: [import.meta.env.VITE_ICONIFY_URL],
|
||||
})
|
||||
}
|
||||
|
||||
@@ -92,7 +92,7 @@ async function select(key: string) {
|
||||
copy()
|
||||
break
|
||||
case "test":
|
||||
window.open("https://code.xuyue.cc", "_blank")
|
||||
window.open(import.meta.env.VITE_CODE_URL, "_blank")
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import axios from "axios"
|
||||
import { decode, encode } from "./functions"
|
||||
import { Code } from "./types"
|
||||
|
||||
const http = axios.create({ baseURL: `https://judge0api.xuyue.cc` })
|
||||
const http = axios.create({ baseURL: import.meta.env.VITE_JUDGE0_URL })
|
||||
|
||||
export async function createTestSubmission(code: Code, input: string) {
|
||||
const encodedCode = encode(code.value)
|
||||
|
||||
12
src/vite-env.d.ts
vendored
12
src/vite-env.d.ts
vendored
@@ -1 +1,13 @@
|
||||
/// <reference types="vite/client" />
|
||||
|
||||
interface ImportMetaEnv {
|
||||
readonly VITE_MAXKB_URL: string
|
||||
readonly VITE_OJ_URL: string
|
||||
readonly VITE_CODE_URL: string
|
||||
readonly VITE_JUDGE0_URL: string
|
||||
readonly VITE_ICONIFY_URL: string
|
||||
}
|
||||
|
||||
interface ImportMeta {
|
||||
readonly env: ImportMetaEnv
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user