Skip to content

Commit

Permalink
fix(): first upload of a file
Browse files Browse the repository at this point in the history
  • Loading branch information
mkucharz committed Dec 19, 2017
1 parent 4a4b020 commit f131294
Show file tree
Hide file tree
Showing 10 changed files with 1,844 additions and 2,510 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
]
},
"dependencies": {
"@syncano/cli": "^0.5.0-alpha.48815720",
"babel-eslint": "^8.0.1",
"chalk": "^2.3.0",
"git-branch": "^1.0.0",
Expand Down
12 changes: 0 additions & 12 deletions packages/cli/book.json

This file was deleted.

3 changes: 2 additions & 1 deletion packages/cli/src/utils/hosting/hosting.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,8 @@ class Hosting {
singleFile = await session.connection.hosting.updateFile(this.name, fileToUpdate.id, payload)
echo(6)(`${format.green('✓')} File updated: ${format.dim(localHostingFilePath)}`)
} catch (err) {
console.log(err)
echo(`Error while syncing (updating) ${localHostingFilePath}`)
debug(err.response.data)
}
}
} else {
Expand All @@ -310,6 +310,7 @@ class Hosting {
echo(6)(`${format.green('✓')} File added: ${format.dim(localHostingFilePath)}`)
} catch (err) {
echo(`Error while syncing (creating) ${file.path}`)
debug(err.response.data)
}
}

Expand Down
18 changes: 0 additions & 18 deletions packages/cli/test.sh

This file was deleted.

4 changes: 2 additions & 2 deletions packages/lib-js-client/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ ansi-styles@^2.2.1:
version "2.2.1"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe"

ansi-styles@^3.2.0:
ansi-styles@^3.1.0, ansi-styles@^3.2.0:
version "3.2.0"
resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88"
dependencies:
Expand Down Expand Up @@ -4280,7 +4280,7 @@ supports-color@^3.1.2:
dependencies:
has-flag "^1.0.0"

supports-color@^4.2.1:
supports-color@^4.0.0, supports-color@^4.2.1:
version "4.5.0"
resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-4.5.0.tgz#be7a0de484dec5c5cddf8b3d59125044912f635b"
dependencies:
Expand Down
13 changes: 7 additions & 6 deletions packages/lib-js-core/src/hosting.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,16 @@ export default class Hosting extends QueryBuilder {
})
}

uploadFile (hostingId, params) {
uploadFile (hostingId, payload) {
return new Promise((resolve, reject) => {
const headers = {
'X-API-KEY': this.instance.accountKey
}
const headers = payload.getHeaders()
headers['X-API-KEY'] = this.instance.accountKey

const options = {
method: 'PATCH',
body: JSON.stringify(params)
method: 'POST',
body: payload
}

this.fetch(this.urlFiles(hostingId), options, headers)
.then(resolve)
.catch(reject)
Expand Down
Loading

0 comments on commit f131294

Please sign in to comment.