-
-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix:(ActionFooter): delete + add edge case (#8)
* feat(api): add actions * feat(utils): add isEmpty and getTrad - remove hasResponseData * feat(trad): add en translation * feat(hooks): add useReactQuery * refactor(components): use react-query for state - fixes delete/add edge case * chore(assets): add new images for redesign
- Loading branch information
1 parent
1891b2d
commit 3eb7525
Showing
19 changed files
with
357 additions
and
135 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import { requestPluginEndpoint } from '../utils/requestPluginEndpoint'; | ||
|
||
const fetchEntityActions = ({ entitySlug, entityId, mode }) => { | ||
let params = { | ||
'filters[entitySlug][$eq]': entitySlug, | ||
'filters[mode][$eq]': mode, | ||
}; | ||
if (entityId) { | ||
params['filters[entityId][$eq]'] = entityId; | ||
} | ||
return requestPluginEndpoint('actions', { | ||
params, | ||
}); | ||
}; | ||
|
||
const createEntityAction = ({ entitySlug, entityId, mode, executeAt }) => { | ||
let body = { | ||
executeAt, | ||
mode, | ||
entitySlug, | ||
}; | ||
|
||
if (entityId) { | ||
body.entityId = entityId; | ||
} | ||
|
||
return requestPluginEndpoint('actions', { | ||
method: 'POST', | ||
body, | ||
}); | ||
}; | ||
|
||
const updateEntityAction = ({ id, executeAt }) => { | ||
let body = { | ||
executeAt, | ||
id, | ||
}; | ||
|
||
return requestPluginEndpoint(`actions/${id}`, { | ||
method: 'PUT', | ||
body, | ||
}); | ||
}; | ||
|
||
const deleteEntityAction = ({ id }) => { | ||
return requestPluginEndpoint(`actions/${id}`, { | ||
method: 'DELETE', | ||
}); | ||
}; | ||
|
||
export { fetchEntityActions, createEntityAction, updateEntityAction, deleteEntityAction }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.