mirror of
https://github.com/valitydev/redash.git
synced 2024-11-08 09:53:59 +00:00
26 lines
667 B
JavaScript
26 lines
667 B
JavaScript
function Alert($resource, $http) {
|
|
const actions = {
|
|
save: {
|
|
method: 'POST',
|
|
transformRequest: [(data) => {
|
|
const newData = Object.assign({}, data);
|
|
if (newData.query_id === undefined) {
|
|
newData.query_id = newData.query.id;
|
|
newData.destination_id = newData.destinations;
|
|
delete newData.query;
|
|
delete newData.destinations;
|
|
}
|
|
|
|
return newData;
|
|
}].concat($http.defaults.transformRequest),
|
|
},
|
|
};
|
|
const resource = $resource('api/alerts/:id', { id: '@id' }, actions);
|
|
|
|
return resource;
|
|
}
|
|
|
|
export default function init(ngModule) {
|
|
ngModule.factory('Alert', Alert);
|
|
}
|