重构ossStore

This commit is contained in:
2025-06-19 23:07:06 +08:00
parent 6e73220962
commit 0758b9f75a
5 changed files with 89 additions and 67 deletions

View File

@@ -3,12 +3,12 @@ import { toast } from "sonner";
import useSWR from "swr";
export function useOssSts() {
const { data: stsTokenData, isLoading, error } = useSWR(
const { data: stsTokenData, isLoading, error, mutate } = useSWR(
'/api/oss/sts',
() => OssApi.getStsToken(),
{
shouldRetryOnError: false,
refreshInterval: 59 * 60 * 1000,
// refreshInterval: 59 * 60 * 1000,
revalidateOnFocus: false,
onError: (e) => {
toast.error(`${e.message || e}`)
@@ -20,5 +20,6 @@ export function useOssSts() {
stsTokenData,
isLoading,
error,
mutate,
}
}