web: 移除Safari<14.5兼容处理

This commit is contained in:
Xwite
2023-05-13 11:10:51 +08:00
parent 31e10b3010
commit 478a50f0eb
4 changed files with 21 additions and 19 deletions

View File

@@ -22,9 +22,18 @@ ajax.interceptors.response.use((response) => response, APIExceptionHandler);
const getReadConfig = () => ajax.get("/getReadConfig");
const saveReadConfig = (config) => ajax.post("/saveReadConfig", config);
const saveBookProcess = (bookProgress) =>
const saveBookProgress = (bookProgress) =>
ajax.post("/saveBookProgress", bookProgress);
const saveBookProgressWithBeacon = (bookProgress) => {
if (!bookProgress) return;
// 常规请求可能会被取消 使用Fetch keep-alive 或者 navigator.sendBeacon
navigator.sendBeacon(
`${import.meta.env.VITE_API || location.origin}/saveBookProgress`,
JSON.stringify(bookProgress)
);
};
const getBookShelf = () => ajax.get("/getBookshelf");
const getChapterList = (/** @type {string} */ bookUrl) =>
@@ -114,7 +123,8 @@ const debug = (
export default {
getReadConfig,
saveReadConfig,
saveBookProcess,
saveBookProgress,
saveBookProgressWithBeacon,
getBookShelf,
getChapterList,
getBookContent,