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