File tree Expand file tree Collapse file tree 20 files changed +267
-129
lines changed Expand file tree Collapse file tree 20 files changed +267
-129
lines changed Original file line number Diff line number Diff line change 1+ {
2+ "parser" : " @typescript-eslint/parser" ,
3+ "plugins" : [" @typescript-eslint" ],
4+ "extends" : [
5+ " plugin:@typescript-eslint/recommended"
6+ ],
7+ "rules" : {
8+ "@typescript-eslint/no-var-requires" : 0 ,
9+ "@typescript-eslint/no-empty-interface" : 0
10+ }
11+ }
Original file line number Diff line number Diff line change 1010 "spec-char-escape" : true ,
1111 "id-unique" : false ,
1212 "src-not-empty" : true ,
13- "title-require" : false ,
13+ "title-require" : true ,
1414 "alt-require" : true ,
1515 "doctype-html5" : true ,
1616 "id-class-value" : false ,
2121 "id-class-ad-disabled" : false ,
2222 "href-abs-or-rel" : false ,
2323 "attr-unsafe-chars" : true ,
24- "head-script-disabled" : false
24+ "head-script-disabled" : true
2525}
Original file line number Diff line number Diff line change 5353 VALIDATE_ALL_CODEBASE : false
5454 DEFAULT_BRANCH : main
5555 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
56+ FILTER_REGEX_EXCLUDE : .*vscode/.*.json
57+ VALIDATE_JAVASCRIPT_STANDARD : false
58+ TYPESCRIPT_ES_CONFIG_FILE : .eslintrc.json
59+ VALIDATE_TYPESCRIPT_STANDARD : false
60+ VALIDATE_MARKDOWN : false
Original file line number Diff line number Diff line change 11<!DOCTYPE html>
22< html lang ="en ">
33 < head >
4+ < title > Blobfishes app</ title >
45 < meta charset ="utf-8 " />
56 < link rel ="icon " href ="/favicon.png " />
67 < link rel ="
stylesheet "
href ="
https://cdn.jsdelivr.net/npm/[email protected] /dist/css/bootstrap.min.css "
>
Original file line number Diff line number Diff line change 1+ import axios from 'axios'
2+ import {
3+ API_PATH
4+ } from './api' ;
5+
6+ const apiAuthorPath = `${ API_PATH } /author` ;
7+
8+ function findAuthors ( ) {
9+ return axios . get ( apiAuthorPath ) ;
10+ }
11+
12+ function insertAuthor ( payload ) {
13+ return axios . post ( apiAuthorPath , payload ) ;
14+ }
15+
16+ function updateAuthor ( id , payload ) {
17+ const path = `${ apiAuthorPath } /${ id } ` ;
18+ return axios . put ( path , payload ) ;
19+ }
20+
21+ function removeAuthor ( id ) {
22+ const path = `${ apiAuthorPath } /${ id } ` ;
23+ return axios . delete ( path ) ;
24+ }
25+
26+ export const apiAuthor = {
27+ findAuthors,
28+ insertAuthor,
29+ updateAuthor,
30+ removeAuthor
31+ }
Original file line number Diff line number Diff line change 1+ import axios from 'axios'
2+ import {
3+ API_PATH
4+ } from './api' ;
5+
6+ const apiBookPath = `${ API_PATH } /book` ;
7+
8+ function findBooks ( ) {
9+ return axios . get ( apiBookPath ) ;
10+ }
11+
12+ function insertBook ( payload ) {
13+ return axios . post ( apiBookPath , payload ) ;
14+ }
15+
16+ function updateBook ( id , payload ) {
17+ const path = `${ apiBookPath } /${ id } ` ;
18+ return axios . put ( path , payload ) ;
19+ }
20+
21+ function removeBook ( id ) {
22+ const path = `${ apiBookPath } /${ id } ` ;
23+ return axios . delete ( path ) ;
24+ }
25+
26+ export const apiBook = {
27+ findBooks,
28+ insertBook,
29+ updateBook,
30+ removeBook
31+ }
Original file line number Diff line number Diff line change 1+ export const API_PATH = '/api' ;
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 11<script >
2- import axios from " axios" ;
32 import { onMount } from " svelte" ;
43 import {
54 Button ,
1413 Label ,
1514 Table ,
1615 } from " sveltestrap" ;
17-
18- const apiPath = " /api/author" ;
16+ import { apiAuthor } from " ../lib/api.author" ;
1917
2018 var authors = [];
2119 var addAuthorForm = {
2826 let updateopen = false ;
2927
3028 function getAuthors () {
31- axios . get ( ` ${ apiPath } ` ).then ((res ) => {
29+ apiAuthor . findAuthors ( ).then ((res ) => {
3230 authors = res .data ;
3331 });
3432 }
3533
3634 function deleteAuthor (author ) {
37- const path = ` ${ apiPath} /${ author ._id } ` ;
38- axios
39- .delete (path)
35+ apiAuthor .removeAuthor (author ._id )
4036 .then (() => {
4137 getAuthors ();
4238 })
5551 }
5652
5753 function addAuthor () {
58- const path = ` ${ apiPath} ` ;
5954 const payload = {
6055 name: addAuthorForm .name ,
6156 bio: addAuthorForm .bio ,
6257 };
63- axios
64- .post (path, payload)
58+ apiAuthor .insertAuthor (payload)
6559 .then (() => {
6660 getAuthors ();
6761 })
7468 }
7569
7670 function updateAuthor () {
77- const path = ` ${ apiPath} /${ addAuthorForm ._id } ` ;
7871 const payload = {
7972 name: addAuthorForm .name ,
8073 bio: addAuthorForm .bio ,
8174 };
82- axios
83- .put (path, payload)
75+ apiAuthor .updateAuthor (addAuthorForm ._id , payload)
8476 .then (() => {
8577 getAuthors ();
8678 })
You can’t perform that action at this time.
0 commit comments