23 lines
505 B
TypeScript
23 lines
505 B
TypeScript
import { mande } from 'mande';
|
|
|
|
export const BASE_URL = process.env.NODE_ENV !== 'production'
|
|
? 'http://localhost:3001'
|
|
: '';
|
|
|
|
const entries = mande(BASE_URL + '/api/entries');
|
|
|
|
export function getEntryBySlug(slug: string): any {
|
|
return entries.get(slug);
|
|
}
|
|
|
|
export function createEntry(): any {
|
|
return entries.put();
|
|
}
|
|
|
|
export function updateEntry(slug: string, data: {}): any {
|
|
return entries.post(slug, data);
|
|
}
|
|
|
|
export function deleteEntry(slug: string): any {
|
|
return entries.post(slug);
|
|
} |