This commit is contained in:
2023-01-13 10:54:34 +08:00
parent ab5cb8610b
commit edce7c4cc7
15 changed files with 30 additions and 29 deletions

View File

@@ -5,11 +5,11 @@ import { Code } from "./types"
const http = axios.create({ baseURL: "https://judge0api.hyyz.izhai.net" })
function encode(str: string) {
return btoa(unescape(encodeURIComponent(str || "")))
return btoa(unescape(encodeURIComponent(str ?? "")))
}
function decode(bytes: string) {
let escaped = escape(atob(bytes || ""))
let escaped = escape(atob(bytes ?? ""))
try {
return decodeURIComponent(escaped)
} catch (e) {