feat: 🎸 Add serializer and adapter for storage bucket (#117)
* feat: 🎸 Add serializer and adapter for storage bucket ✅ Closes: ICU-8358
This commit is contained in:
1 parent
a28e7810e7
commit
5992829fa2
8 files changed
+175
-2
No files matched your search
@@ -0,0 +1,23 @@
|
||||
import ApplicationAdapter from './application';
|
||||
|
||||
export default class StorageBucketAdapter extends ApplicationAdapter {
|
||||
/**
|
||||
* Overrides the default `buildURL` such that on _create_, URLs for records of
|
||||
* type `plugin` get an extra query parameter `?plugin_name`. All other
|
||||
* request types behave as normal.
|
||||
*
|
||||
* @override
|
||||
* @param {string} modelName
|
||||
* @param {string} id
|
||||
* @return {string} url
|
||||
* @return {string} requestType
|
||||
*/
|
||||
buildURL(modelName, id, snapshot, requestType) {
|
||||
let url = super.buildURL(...arguments);
|
||||
const pluginName = snapshot?.attr('plugin')?.name;
|
||||
if (requestType === 'createRecord' && pluginName) {
|
||||
url = `${url}?plugin_name=${pluginName}`;
|
||||
}
|
||||
return url;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user