mirror of
https://github.com/pinry/pinry.git
synced 2025-11-16 18:05:51 +01:00
Feature: Create Pin from uploaded file
This commit is contained in:
committed by
Isaac Bythewood
parent
bb24ed3ecf
commit
0006aad6f7
@@ -4,13 +4,33 @@ import storage from './utils/storage';
|
||||
const API_PREFIX = '/api/v2/';
|
||||
|
||||
const Pin = {
|
||||
createFromURL(jsonData) {
|
||||
create(jsonData) {
|
||||
const url = `${API_PREFIX}pins/`;
|
||||
return axios.post(
|
||||
url,
|
||||
jsonData,
|
||||
);
|
||||
},
|
||||
createFromURL(jsonData) {
|
||||
return this.create(jsonData);
|
||||
},
|
||||
createFromUploaded(jsonData) {
|
||||
return this.create(jsonData);
|
||||
},
|
||||
uploadImage(fileObject) {
|
||||
const url = `${API_PREFIX}images/`;
|
||||
const data = new FormData();
|
||||
data.append('image', fileObject);
|
||||
return axios.post(
|
||||
url,
|
||||
data,
|
||||
{
|
||||
headers: {
|
||||
'Content-Type': 'multipart/form-data',
|
||||
},
|
||||
},
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user