refactor(storage): 将 storage 工具类导出名重命名为 storageUtil
- 将 utils/chromeStorage.ts 中的 storage 导出重命名为 storageUtil - 更新 RoutePersistence.tsx 中的导入和引用以使用新名称 - 优化 recordUtils.tsx 中 chrome.downloads 的链式调用格式 使工具类的命名更加清晰,避免与全局 storage 概念混淆
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import { useEffect, useRef } from 'react';
|
||||
import { useLocation, useNavigate } from 'react-router-dom';
|
||||
import { storage } from '@/utils/chromeStorage';
|
||||
import { storageUtil } from '@/utils/chromeStorage';
|
||||
|
||||
const RoutePersistence = () => {
|
||||
const location = useLocation();
|
||||
@@ -13,7 +13,7 @@ const RoutePersistence = () => {
|
||||
if (isRestored.current) return;
|
||||
|
||||
try {
|
||||
const lastRoute = await storage.get('app/lastRoute');
|
||||
const lastRoute = await storageUtil.get('app/lastRoute');
|
||||
|
||||
if (lastRoute && lastRoute !== '/' && location.pathname === '/') {
|
||||
navigate(lastRoute, { replace: true });
|
||||
@@ -32,7 +32,7 @@ const RoutePersistence = () => {
|
||||
useEffect(() => {
|
||||
const saveRoute = async () => {
|
||||
if (!isRestored.current) return;
|
||||
await storage.set('app/lastRoute', location.pathname);
|
||||
await storageUtil.set('app/lastRoute', location.pathname);
|
||||
console.log('保存路由', location.pathname);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user