chore: add empty response endpoint
Signed-off-by: Ameya Shenoy <shenoy.ameya@gmail.com>
This commit is contained in:
parent
d2f5de31ce
commit
0f76a31b61
3 changed files with 13 additions and 4 deletions
|
|
@ -1,7 +1,8 @@
|
||||||
from django.urls import path
|
from django.urls import path
|
||||||
from app.views import BhavCopyEquityView, BhavCopyEquityDefaultRedisView
|
from app.views import BhavCopyEquityView, BhavCopyEquityDefaultRedisView, EmptyRespoinseView
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
|
path('emptyresponse/', EmptyRespoinseView.as_view(), name='emptyresponse_view'),
|
||||||
path('bhavcopyequity/', BhavCopyEquityView.as_view(), name='bhavcopyequity_view'),
|
path('bhavcopyequity/', BhavCopyEquityView.as_view(), name='bhavcopyequity_view'),
|
||||||
path('bhavcopyequitydefaultredis/', BhavCopyEquityDefaultRedisView.as_view(), name='bhavcopyequity_view'),
|
path('bhavcopyequitydefaultredis/', BhavCopyEquityDefaultRedisView.as_view(), name='bhavcopyequitydefaultredis_view'),
|
||||||
]
|
]
|
||||||
|
|
|
||||||
|
|
@ -30,3 +30,9 @@ class BhavCopyEquityDefaultRedisView(generics.RetrieveAPIView):
|
||||||
serializer = BhavCopyEquitySerializer(queryset, many=True)
|
serializer = BhavCopyEquitySerializer(queryset, many=True)
|
||||||
return Response(serializer.data)
|
return Response(serializer.data)
|
||||||
|
|
||||||
|
|
||||||
|
class EmptyRespoinseView(generics.RetrieveAPIView):
|
||||||
|
def get(self, request, *args, **kwargs):
|
||||||
|
return Response([])
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -75,8 +75,9 @@
|
||||||
link.click();
|
link.click();
|
||||||
},
|
},
|
||||||
populateApiData() {
|
populateApiData() {
|
||||||
console.log(`Fetching data from ${this.apiEndpointSelected.endpoint} API`)
|
var endpoint = this.apiEndpointSelected.endpoint;
|
||||||
getAPI.get(`/${this.apiEndpointSelected.endpoint}/`,)
|
console.log(`Fetching data from ${endpoint} API`)
|
||||||
|
getAPI.get(`/${endpoint}/`,)
|
||||||
.then(response => {
|
.then(response => {
|
||||||
console.log('BhavCopyEquity API has recieved data')
|
console.log('BhavCopyEquity API has recieved data')
|
||||||
this.apiData = response.data
|
this.apiData = response.data
|
||||||
|
|
@ -97,6 +98,7 @@
|
||||||
apiData: [],
|
apiData: [],
|
||||||
apiEndpointSelected: { endpoint: 'bhavcopyequity', text: "Plain Endpoint" },
|
apiEndpointSelected: { endpoint: 'bhavcopyequity', text: "Plain Endpoint" },
|
||||||
apiEndpoints: [
|
apiEndpoints: [
|
||||||
|
{ endpoint: 'emptyresponse', text: "Empty Response Endpoint" },
|
||||||
{ endpoint: 'bhavcopyequity', text: "Plain Endpoint" },
|
{ endpoint: 'bhavcopyequity', text: "Plain Endpoint" },
|
||||||
{ endpoint: 'bhavcopyequitydefaultredis', text: "Default Redis Cache" }
|
{ endpoint: 'bhavcopyequitydefaultredis', text: "Default Redis Cache" }
|
||||||
],
|
],
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue