@api_view(['POST'])
def reset_webhooks(request):
    if (not request.user.is_authenticated):
        return JsonResponse({'error': 'You must be logged into access this endpoint.'})
    data = request.data
    if (data['type'] == 'all'):
        teardown_all_acct_webhooks()
    elif (data['type'] == 'remote'):
        token = Token.objects.get(user=request.user)
        cleanup_remote_webhooks()
    elif (data['type'] == 'broken'):
        token = Token.objects.get(user=request.user)
        cleanup_webhooks()
    else:
        return JsonResponse({'webhooks_reset': False, 'error': 'Proper type not found.'})
    config.FORCE_WEBHOOK_REFRESH = True
    return JsonResponse({'webhooks_reset': True})
@api_view(['POST'])
def reset_webhooks(request):
    if (not request.user.is_authenticated):
        return JsonResponse({'error': 'You must be logged into access this endpoint.'})
    data = request.data
    if (data['type'] == 'all'):
        teardown_all_acct_webhooks()
    elif (data['type'] == 'remote'):
        token = Token.objects.get(user=request.user)
        cleanup_remote_webhooks()
    elif (data['type'] == 'broken'):
        token = Token.objects.get(user=request.user)
        cleanup_webhooks()
    else:
        return JsonResponse({'webhooks_reset': False, 'error': 'Proper type not found.'})
    config.FORCE_WEBHOOK_REFRESH = True
    return JsonResponse({'webhooks_reset': True})