diff --git a/Dockerfile b/Dockerfile index 727ed2a..cb5d1b0 100644 --- a/Dockerfile +++ b/Dockerfile @@ -24,10 +24,10 @@ COPY ["package.json", "package-lock.json*", "npm-shrinkwrap.json*", "./"] # RUN ls -laR RUN npm install --silent COPY . . -RUN npm run build +RUN npm run build:server # RUN ls -la # RUN ls -laR dist/ -CMD ["node", "dist/app.js"] +CMD ["npm", "run", "serve:prod"] # ----------------------------------------------------------------- # # EOF diff --git a/client/src/lib/requests.js b/client/src/lib/requests.js new file mode 100644 index 0000000..6390828 --- /dev/null +++ b/client/src/lib/requests.js @@ -0,0 +1,14 @@ +import axios from 'axios' + +const apiPath = '/api/author' + +function getAuthors () { + axios.get(`${apiPath}`) + .then((res) => { + return (res.data) + }) +} + +export default { + getAuthors +} diff --git a/client/src/routes/authors.svelte b/client/src/routes/authors.svelte index 7a8c275..977db6c 100644 --- a/client/src/routes/authors.svelte +++ b/client/src/routes/authors.svelte @@ -19,16 +19,11 @@ var authors = []; var addAuthorForm = { - id: "", + _id: "", name: "", bio: "", }; - var editForm = { - _id: "", - title: "", - author: "", - description: "", - }; + let addopen = false; let updateopen = false; @@ -72,9 +67,10 @@ }) .catch((error) => { console.error(error); + alert(error); getAuthors(); - }); - closeDialog(); + }) + .finally(() => closeDialog()); } function updateAuthor() { diff --git a/client/src/routes/books.svelte b/client/src/routes/books.svelte index 81a3d53..f9680a4 100644 --- a/client/src/routes/books.svelte +++ b/client/src/routes/books.svelte @@ -1,10 +1,33 @@