feat: 优化项目目录结构
This commit is contained in:
22
apps/frontend/hooks/admin/web/blog/use-oss-store.ts
Normal file
22
apps/frontend/hooks/admin/web/blog/use-oss-store.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import { useOssSts } from "@/hooks/oss/use-oss-sts";
|
||||
import { StsToken } from "@/lib/api/oss";
|
||||
import { useEffect } from "react";
|
||||
|
||||
export function useOssStore(options: { onStsTokenDataChanged?: (data: StsToken | undefined) => void; } = {}) {
|
||||
const { stsTokenData, isLoading, error, mutate } = useOssSts();
|
||||
|
||||
useEffect(() => {
|
||||
options.onStsTokenDataChanged?.(stsTokenData);
|
||||
}, [stsTokenData]);
|
||||
|
||||
const refresh = async () => {
|
||||
await mutate();
|
||||
}
|
||||
|
||||
return {
|
||||
stsTokenData,
|
||||
isLoading,
|
||||
error,
|
||||
refresh,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user