mirror of
https://github.com/pinry/pinry.git
synced 2025-11-16 18:05:51 +01:00
Feature: Add board creation
+ Refactor form-error settings and reset function
This commit is contained in:
committed by
Isaac Bythewood
parent
b3a065a4fb
commit
41cac8e784
@@ -3,6 +3,28 @@ import storage from './utils/storage';
|
||||
|
||||
const API_PREFIX = '/api/v2/';
|
||||
|
||||
const Board = {
|
||||
create(name) {
|
||||
const url = `${API_PREFIX}boards/`;
|
||||
const data = { name };
|
||||
return new Promise(
|
||||
(resolve, reject) => {
|
||||
axios.post(url, data).then(
|
||||
(resp) => {
|
||||
if (resp.status !== 201) {
|
||||
reject(resp);
|
||||
}
|
||||
resolve(resp.data);
|
||||
},
|
||||
(error) => {
|
||||
reject(error.response);
|
||||
},
|
||||
);
|
||||
},
|
||||
);
|
||||
},
|
||||
};
|
||||
|
||||
const Pin = {
|
||||
create(jsonData) {
|
||||
const url = `${API_PREFIX}pins/`;
|
||||
@@ -192,6 +214,7 @@ const User = {
|
||||
|
||||
export default {
|
||||
Pin,
|
||||
Board,
|
||||
fetchPin,
|
||||
fetchPins,
|
||||
fetchPinsForBoard,
|
||||
|
||||
Reference in New Issue
Block a user