mirror of
https://github.com/pinry/pinry.git
synced 2025-11-18 02:40:40 +01:00
Feature: Use drf-api for Pin-creation
This commit is contained in:
@@ -77,7 +77,7 @@ function deletePinData(pinId) {
|
|||||||
function postPinData(data) {
|
function postPinData(data) {
|
||||||
return $.ajax({
|
return $.ajax({
|
||||||
type: "post",
|
type: "post",
|
||||||
url: "/api/v1/pin/",
|
url: API_BASE + "pins/",
|
||||||
contentType: 'application/json',
|
contentType: 'application/json',
|
||||||
data: JSON.stringify(data)
|
data: JSON.stringify(data)
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ $(window).load(function() {
|
|||||||
var data = {
|
var data = {
|
||||||
description: $('#pin-form-description').val(),
|
description: $('#pin-form-description').val(),
|
||||||
tags: cleanTags($('#pin-form-tags').val())
|
tags: cleanTags($('#pin-form-tags').val())
|
||||||
}
|
};
|
||||||
var promise = $.ajax({
|
var promise = $.ajax({
|
||||||
type: "patch",
|
type: "patch",
|
||||||
url: apiUrl,
|
url: apiUrl,
|
||||||
@@ -166,13 +166,15 @@ $(window).load(function() {
|
|||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
var data = {
|
var data = {
|
||||||
submitter: '/api/v1/user/'+currentUser.id+'/',
|
|
||||||
referer: $('#pin-form-referer').val(),
|
referer: $('#pin-form-referer').val(),
|
||||||
description: $('#pin-form-description').val(),
|
description: $('#pin-form-description').val(),
|
||||||
tags: cleanTags($('#pin-form-tags').val())
|
tags: cleanTags($('#pin-form-tags').val())
|
||||||
};
|
};
|
||||||
if (uploadedImage) data.image = '/api/v1/image/'+uploadedImage+'/';
|
if (uploadedImage) {
|
||||||
else data.url = $('#pin-form-image-url').val();
|
data.image_id = uploadedImage;
|
||||||
|
} else {
|
||||||
|
data.url = $('#pin-form-image-url').val();
|
||||||
|
}
|
||||||
var promise = postPinData(data);
|
var promise = postPinData(data);
|
||||||
promise.success(function(pin) {
|
promise.success(function(pin) {
|
||||||
if (pinFromUrl) return window.close();
|
if (pinFromUrl) return window.close();
|
||||||
|
|||||||
Reference in New Issue
Block a user