123
This commit is contained in:
@@ -20,6 +20,8 @@ type Policy = {
|
||||
keySecret: string,
|
||||
region: string,
|
||||
token: string,
|
||||
|
||||
cdnDomain: string
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -41,7 +43,8 @@ export function useUpload() {
|
||||
keyId: "",
|
||||
keySecret: "",
|
||||
region: "",
|
||||
token: ""
|
||||
token: "",
|
||||
cdnDomain: ""
|
||||
};
|
||||
|
||||
const init = () => {
|
||||
@@ -149,7 +152,11 @@ export function useUpload() {
|
||||
headers: { "Content-Type": "text/plain" },
|
||||
};
|
||||
const result = await client.put(getRandomFileName(), file, options);
|
||||
callback && callback(result?.url);
|
||||
let ppUrl = result?.url
|
||||
if(policy.cdnDomain){
|
||||
ppUrl = policy.cdnDomain + result.name
|
||||
}
|
||||
callback && callback(ppUrl);
|
||||
return Promise.resolve()
|
||||
} catch (e) {
|
||||
console.log(e);
|
||||
|
||||
Reference in New Issue
Block a user