|
|
@@ -1,21 +1,21 @@
|
|
|
import { appApi } from 'src/boot/axios.js'
|
|
|
import APIRepository from '../classes/APIRepository.js'
|
|
|
-import { Alert, AlertList } from 'src/models/Alert.js'
|
|
|
+import { Subscription, SubscriptionList } from 'src/models/Subscription.js'
|
|
|
|
|
|
-export default class AlertAPI extends APIRepository {
|
|
|
+export default class SubscriptionAPI extends APIRepository {
|
|
|
constructor() {
|
|
|
- super('alert', appApi)
|
|
|
+ super('subscription', appApi)
|
|
|
this.APIAdresses = {
|
|
|
- base: '/mma/alerts',
|
|
|
- byId: (id) => '/mma/alerts/' + id,
|
|
|
- myCorrespondingAlert: '/mma/alerts/my_corresponding_alert'
|
|
|
+ base: '/mma/subscriptions',
|
|
|
+ byId: (id) => '/mma/subscriptions/' + id,
|
|
|
+ myCorrespondingSubscription: '/mma/subscriptions/my_corresponding_subscription'
|
|
|
}
|
|
|
this.restUrl = (id) => this.url + '/' + id
|
|
|
/* Setting the callback functions for the CRUD operations. */
|
|
|
this.setCrudCallbacks({
|
|
|
- get: (response) => { return new Alert(response.data) },
|
|
|
- post: (response) => { return new Alert(response.data) },
|
|
|
- put: (response) => { return new Alert(response.data) },
|
|
|
+ get: (response) => { return new Subscription(response.data) },
|
|
|
+ post: (response) => { return new Subscription(response.data) },
|
|
|
+ put: (response) => { return new Subscription(response.data) },
|
|
|
delete: (response) => { return response.data }
|
|
|
})
|
|
|
}
|
|
|
@@ -33,7 +33,7 @@ export default class AlertAPI extends APIRepository {
|
|
|
const results = response.data.results
|
|
|
delete paginate.results
|
|
|
return {
|
|
|
- list: new AlertList(results),
|
|
|
+ list: new SubscriptionList(results),
|
|
|
paginate
|
|
|
// {
|
|
|
// "count": 1,
|
|
|
@@ -51,16 +51,16 @@ export default class AlertAPI extends APIRepository {
|
|
|
})
|
|
|
}
|
|
|
|
|
|
- getMyCorrespondingAlert(data) {
|
|
|
+ getMyCorrespondingSubscription(data) {
|
|
|
return this.sendRequest({
|
|
|
apiMethod: 'get',
|
|
|
api: this.api,
|
|
|
- request: this.APIAdresses.myCorrespondingAlert,
|
|
|
+ request: this.APIAdresses.myCorrespondingSubscription,
|
|
|
data: this.getNormalizedSendData({
|
|
|
source_type: 'UNIT' //
|
|
|
}, data),
|
|
|
resolveCallback: (response) => {
|
|
|
- return new Alert(response.data)
|
|
|
+ return new Subscription(response.data)
|
|
|
},
|
|
|
rejectCallback: (error) => {
|
|
|
return error
|
|
|
@@ -77,7 +77,7 @@ export default class AlertAPI extends APIRepository {
|
|
|
source_type: 'UNIT'
|
|
|
}, data),
|
|
|
resolveCallback: (response) => {
|
|
|
- return new Alert(response.data)
|
|
|
+ return new Subscription(response.data)
|
|
|
},
|
|
|
rejectCallback: (error) => {
|
|
|
return error
|
|
|
@@ -94,7 +94,7 @@ export default class AlertAPI extends APIRepository {
|
|
|
state: 'READ'
|
|
|
},
|
|
|
resolveCallback: (response) => {
|
|
|
- return new Alert(response.data)
|
|
|
+ return new Subscription(response.data)
|
|
|
},
|
|
|
rejectCallback: (error) => {
|
|
|
return error
|