Feature: Use v2-api for pin-detail page

This commit is contained in:
winkidney
2019-02-21 14:57:13 +08:00
parent 153dc0daef
commit da8bac1491
3 changed files with 4 additions and 14 deletions

View File

@@ -92,10 +92,8 @@ class PinSerializer(serializers.HyperlinkedModelSerializer):
"image_by_id",
"tags",
)
extra_kwargs = {
"submitter": {"read_only": True},
}
submitter = UserSerializer(read_only=True)
tags = TagSerializer(
many=True,
source="tag_list",

View File

@@ -5,6 +5,7 @@
* Updated: Feb 26th, 2013
* Require: jQuery
*/
var API_BASE = "/api/v2/";
function _getCookie(name) {
@@ -60,15 +61,8 @@ function cleanTags(tags) {
return tags;
}
function getImageData(imageId) {
var apiUrl = '/api/v1/image/'+imageId+'/?format=json';
return $.get(apiUrl);
}
function getPinData(pinId) {
var apiUrl = '/api/v1/pin/'+pinId+'/?format=json';
var apiUrl = API_BASE + "pins/" + pinId + '/?format=json';
return $.get(apiUrl);
}

View File

@@ -9,8 +9,6 @@
$(window).load(function() {
var api_base = "/api/v2/";
var uploadedImage = false;
var editedPin = null;
@@ -101,7 +99,7 @@ $(window).load(function() {
}
// Drag and drop upload
$('#pin-form-image-upload').dropzone({
url: api_base + "images/",
url: API_BASE + "images/",
paramName: 'image',
parallelUploads: 1,
uploadMultiple: false,