Skip to content

Commit

Permalink
Merge pull request #2100 from sanger/2082-y24-490-as-developers-we-wa…
Browse files Browse the repository at this point in the history
…nt-to-remove-axios-and-the-v1-api-to-make-our-code-more-maintainable-e-no-longer-need-it-as-we-have-moved-to-v2-fetch

Y24-490 - As developers we want to remove Axios and the v1 API
  • Loading branch information
stevieing authored Dec 10, 2024
2 parents 10e4f98 + 6096ae2 commit 94a8f24
Show file tree
Hide file tree
Showing 34 changed files with 316 additions and 2,116 deletions.
43 changes: 7 additions & 36 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
"@sanger/ui-styling": "^4.1.0",
"@vitejs/plugin-vue": "^5.2.1",
"autoprefixer": "^10.4.20",
"axios": "^1.7.8",
"csv-parse": "^5.6.0",
"global": "^4.4.0",
"lodash-es": "^4.17.21",
Expand Down
34 changes: 0 additions & 34 deletions src/api/JsonApi.js
Original file line number Diff line number Diff line change
Expand Up @@ -170,36 +170,6 @@ const extractRelationships = (relationships, included, includeStore = {}) => {
}, {})
}

const extractResourceObject = (data, included, includeStore = {}) => {
return Object.assign(
extractAttributes(data),
extractRelationships(data.relationships, included, includeStore),
)
}

/*
Deserialize a json-api object to bring included relationships, ids and types inline.
@param response: {data: Object, included: Object} the object to deserialize
DEPRECATED: use populate by methods instead
*/
const deserialize = ({ data, included }, includeStore = {}) => {
if (Array.isArray(data)) {
return data.reduce((result, item) => {
const resourceObject = extractResourceObject(item, included, includeStore)
const type = resourceObject.type
if (Array.isArray(result[type])) {
result[type].push(resourceObject)
} else {
result[type] = [resourceObject]
}
return result
}, {})
} else {
const resourceObject = extractResourceObject(data, included, includeStore)
return { [resourceObject.type]: [resourceObject] }
}
}

const matchesAllAttributes =
(filters) =>
({ attributes }) =>
Expand Down Expand Up @@ -401,8 +371,6 @@ export {
findIncluded,
deserializeIncluded,
extractRelationships,
extractResourceObject,
deserialize,
dataToObjectById,
extractRelationshipsAndGroupById,
mapAttribute,
Expand All @@ -415,5 +383,3 @@ export {
extractIncludes,
find,
}

export default deserialize
99 changes: 0 additions & 99 deletions src/api/v1/ApiBuilder.js

This file was deleted.

41 changes: 0 additions & 41 deletions src/api/v1/PromiseHelper.js

This file was deleted.

44 changes: 0 additions & 44 deletions src/api/v1/Response.js

This file was deleted.

Loading

0 comments on commit 94a8f24

Please sign in to comment.