Merge pull request #602 from NebulousLabs/skynet-js-3.0.0
Update skynet-js to version 3.0.0
This commit is contained in:
commit
1a4320d149
|
@ -31,7 +31,7 @@
|
||||||
"react-mailchimp-subscribe": "2.1.0",
|
"react-mailchimp-subscribe": "2.1.0",
|
||||||
"react-syntax-highlighter": "15.4.3",
|
"react-syntax-highlighter": "15.4.3",
|
||||||
"react-visibility-sensor": "5.1.1",
|
"react-visibility-sensor": "5.1.1",
|
||||||
"skynet-js": "2.4.0"
|
"skynet-js": "3.0.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"cypress": "6.3.0",
|
"cypress": "6.3.0",
|
||||||
|
|
|
@ -14,7 +14,7 @@ const client = new SkynetClient();
|
||||||
async function example() {
|
async function example() {
|
||||||
try {
|
try {
|
||||||
// upload
|
// upload
|
||||||
const skylink = await client.uploadFile(file);
|
const { skylink } = await client.uploadFile(file);
|
||||||
console.log(\`Upload successful, skylink: \${skylink}\`);
|
console.log(\`Upload successful, skylink: \${skylink}\`);
|
||||||
|
|
||||||
// download
|
// download
|
||||||
|
|
|
@ -130,7 +130,7 @@ export default function HomeUpload() {
|
||||||
response = await client.uploadFile(file, { onUploadProgress });
|
response = await client.uploadFile(file, { onUploadProgress });
|
||||||
}
|
}
|
||||||
|
|
||||||
onFileStateChange(file, { status: "complete", url: client.getSkylinkUrl(response) });
|
onFileStateChange(file, { status: "complete", url: client.getSkylinkUrl(response.skylink) });
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
if (error.response && error.response.status === StatusCodes.TOO_MANY_REQUESTS) {
|
if (error.response && error.response.status === StatusCodes.TOO_MANY_REQUESTS) {
|
||||||
onFileStateChange(file, { progress: -1 });
|
onFileStateChange(file, { progress: -1 });
|
||||||
|
|
Reference in New Issue