Skip to content

Commit

Permalink
fix: linting errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jazibsawar committed Sep 5, 2022
1 parent e9b1f07 commit 990354a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion src/bucket.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const bucket_methods = (bucket_config) => ({
...objectMethods(bucket_config),
...objectTypeMethods((bucket_config)),
...mediaMethods((bucket_config)),
...userMethods(bucket_config),
...userMethods(bucket_config)
// ...webhookMethods(bucket_config), // TODO
// ...extensionMethods(bucket_config) // TODO
})
Expand Down
18 changes: 10 additions & 8 deletions src/bucket/object-type.js
Original file line number Diff line number Diff line change
@@ -1,21 +1,23 @@
const { URI } = require('../helpers/constants')
const HTTP_METHODS = require('../helpers/http_methods')
const { requestHandler } = require('../helpers/request_handler')
let headers;

let headers

const objectTypeMethods = (bucket_config) => ({
getObjectTypes: (params) => {
let endpoint = `${URI}/buckets/${bucket_config.slug}/object-types?read_key=${bucket_config.read_key}`
getObjectTypes: () => {
const endpoint = `${URI}/buckets/${bucket_config.slug}/object-types?read_key=${bucket_config.read_key}`
return requestHandler(HTTP_METHODS.GET, endpoint)
},
getObjectType: (params) => {
let endpoint = `${URI}/buckets/${bucket_config.slug}/object-types/${params.slug}?read_key=${bucket_config.read_key}`
const endpoint = `${URI}/buckets/${bucket_config.slug}/object-types/${params.slug}?read_key=${bucket_config.read_key}`
return requestHandler(HTTP_METHODS.GET, endpoint)
},
addObjectType: (params) => {
const endpoint = `${URI}/buckets/${bucket_config.slug}/object-types`
if (bucket_config.write_key) {
headers = {
"Authorization": `Bearer ${bucket_config.write_key}`
Authorization: `Bearer ${bucket_config.write_key}`
}
}
return requestHandler(HTTP_METHODS.POST, endpoint, params, headers)
Expand All @@ -24,18 +26,18 @@ const objectTypeMethods = (bucket_config) => ({
const endpoint = `${URI}/buckets/${bucket_config.slug}/object-types/${params.slug}`
if (bucket_config.write_key) {
headers = {
"Authorization": `Bearer ${bucket_config.write_key}`
Authorization: `Bearer ${bucket_config.write_key}`
}
}
// Remove slug
delete params.slug;
delete params.slug
return requestHandler(HTTP_METHODS.PATCH, endpoint, params, headers)
},
deleteObjectType: (params) => {
const endpoint = `${URI}/buckets/${bucket_config.slug}/object-types/${params.slug}`
if (bucket_config.write_key) {
headers = {
"Authorization": `Bearer ${bucket_config.write_key}`
Authorization: `Bearer ${bucket_config.write_key}`
}
}
return requestHandler(HTTP_METHODS.DELETE, endpoint, null, headers)
Expand Down
2 changes: 1 addition & 1 deletion src/helpers/http_methods.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ const HTTP_METHODS = {
GET: 'get',
FETCH: 'fetch',
PUT: 'put',
PATCH: 'patch',
PATCH: 'patch',
DELETE: 'delete'
}

Expand Down
2 changes: 1 addition & 1 deletion src/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ const mainMethods = {
deleteBucket: (params) => {
const endpoint = `${URI}/buckets/${params.slug}`
return requestHandler(HTTP_METHODS.DELETE, endpoint, params)
},
}
}

module.exports = mainMethods

0 comments on commit 990354a

Please sign in to comment.