feat: 优化项目目录结构
This commit is contained in:
25
apps/frontend/hooks/oss/use-oss-sts.ts
Normal file
25
apps/frontend/hooks/oss/use-oss-sts.ts
Normal file
@@ -0,0 +1,25 @@
|
||||
import { OssApi } from "@/lib/api";
|
||||
import { toast } from "sonner";
|
||||
import useSWR from "swr";
|
||||
|
||||
export function useOssSts() {
|
||||
const { data: stsTokenData, isLoading, error, mutate } = useSWR(
|
||||
'/api/oss/sts',
|
||||
() => OssApi.getStsToken(),
|
||||
{
|
||||
shouldRetryOnError: false,
|
||||
// refreshInterval: 59 * 60 * 1000,
|
||||
revalidateOnFocus: false,
|
||||
onError: (e) => {
|
||||
toast.error(`${e.message || e}`)
|
||||
}
|
||||
}
|
||||
);
|
||||
|
||||
return {
|
||||
stsTokenData,
|
||||
isLoading,
|
||||
error,
|
||||
mutate,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user