switched to actual api, not stub
This commit is contained in:
@@ -1,9 +1,14 @@
|
|||||||
|
// for development, to use api-stub, just import it here and export it at the end;
|
||||||
|
// it's a one-liner that switches from stub to actual api
|
||||||
|
|
||||||
const api = {};
|
const api = {};
|
||||||
|
|
||||||
|
let prefix = "/api";
|
||||||
|
|
||||||
api.post = function(url, body){
|
api.post = function(url, body){
|
||||||
return m.request({
|
return m.request({
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
url,
|
prefix+url,
|
||||||
body
|
body
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
+1
-2
@@ -1,6 +1,5 @@
|
|||||||
import nanoid from '../nanoid.min.js';
|
import nanoid from '../nanoid.min.js';
|
||||||
//import api from '../api.js';
|
import api from '../api.js';
|
||||||
import api from '../api-stub.js';
|
|
||||||
|
|
||||||
const load_notes = function(state, dispatch){
|
const load_notes = function(state, dispatch){
|
||||||
api.post('/load-notes', {bin_id: state.bin.id})
|
api.post('/load-notes', {bin_id: state.bin.id})
|
||||||
|
|||||||
+1
-2
@@ -1,5 +1,4 @@
|
|||||||
//import api from '../api.js';
|
import api from '../api.js';
|
||||||
import api from '../api-stub.js';
|
|
||||||
|
|
||||||
const edit_handler = function(note_state, dispatch){
|
const edit_handler = function(note_state, dispatch){
|
||||||
dispatch('update-note-editing', {id: note_state.note.id, is_editing: true});
|
dispatch('update-note-editing', {id: note_state.note.id, is_editing: true});
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
import api from '../api-stub.js';
|
import api from '../api.js';
|
||||||
|
|
||||||
const load_bin_handler = function(state, dispatch, bin_id){
|
const load_bin_handler = function(state, dispatch, bin_id){
|
||||||
/*
|
/*
|
||||||
|
|||||||
Reference in New Issue
Block a user