Skip to content

Commit

Permalink
Added deleteJson and deleteString functions to apiConnector
Browse files Browse the repository at this point in the history
  • Loading branch information
gius committed Dec 19, 2019
1 parent 32af796 commit b8387aa
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 40 deletions.
16 changes: 8 additions & 8 deletions demo/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@frui.ts/demo",
"private": true,
"version": "0.7.0",
"version": "0.7.1",
"description": "> TODO: description",
"author": "Augustin Šulc <[email protected]>",
"license": "ISC",
Expand All @@ -24,12 +24,12 @@
"proxy": "lcp --proxyUrl https://redmine.dev.eman.cz"
},
"dependencies": {
"@frui.ts/apiclient": "^0.7.0",
"@frui.ts/data": "^0.7.0",
"@frui.ts/datascreens": "^0.7.0",
"@frui.ts/dirtycheck": "^0.7.0",
"@frui.ts/screens": "^0.7.0",
"@frui.ts/validation": "^0.7.0",
"@frui.ts/views": "^0.7.0"
"@frui.ts/apiclient": "^0.7.1",
"@frui.ts/data": "^0.7.1",
"@frui.ts/datascreens": "^0.7.1",
"@frui.ts/dirtycheck": "^0.7.1",
"@frui.ts/screens": "^0.7.1",
"@frui.ts/validation": "^0.7.1",
"@frui.ts/views": "^0.7.1"
}
}
2 changes: 1 addition & 1 deletion lerna.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "0.7.0",
"version": "0.7.1",
"packages": [
"demo",
"packages/*",
Expand Down
4 changes: 2 additions & 2 deletions packages/apiclient/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publishConfig": {
"registry": "https://nexus.eman.cz/repository/eman-npm/"
},
"version": "0.7.0",
"version": "0.7.1",
"description": "Frui.ts helpers for http communication",
"author": "Augustin Šulc <[email protected]>",
"license": "ISC",
Expand All @@ -24,6 +24,6 @@
"build": "tsc"
},
"dependencies": {
"@frui.ts/helpers": "^0.7.0"
"@frui.ts/helpers": "^0.7.1"
}
}
7 changes: 7 additions & 0 deletions packages/apiclient/src/fetchApiConnector.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,16 @@ export class FetchApiConnector implements IApiConnector {
patchFormData(url: string, data: FormData, params?: RequestInit): Promise<Response> {
return this.fetchFunction(url, { ...params, method: "patch", body: data }).then(this.middleware);
}

delete(url: string, params?: RequestInit): Promise<Response> {
return this.fetchFunction(url, { ...params, method: "delete" }).then(this.middleware);
}
deleteJson(url: string, content: any, params?: RequestInit): Promise<Response> {
return this.deleteText(url, JSON.stringify(content), appendJsonHeader(params));
}
deleteText(url: string, text: string, params?: RequestInit): Promise<Response> {
return this.fetchFunction(url, { ...params, method: "delete", body: text }).then(this.middleware);
}
}

/** Middleware used by FetchApiConnector to handle response status codes other than 2xx as errors */
Expand Down
6 changes: 4 additions & 2 deletions packages/apiclient/src/restRequestBuilder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,10 @@ export class RestRequestBuilder {
return this.apiConnector.patchJson(this.url, content, this.params);
}

delete() {
return this.apiConnector.delete(this.url, this.params);
delete(content: any) {
return content
? this.apiConnector.deleteJson(this.url, content, this.params)
: this.apiConnector.delete(this.url, this.params);
}

withBaseUrl(url: string) {
Expand Down
2 changes: 2 additions & 0 deletions packages/apiclient/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,6 @@ export interface IApiConnector {
patchFormData(url: string, data: FormData, params?: RequestInit): Promise<Response>;

delete(url: string, params?: RequestInit): Promise<Response>;
deleteText(url: string, text: string, params?: RequestInit): Promise<Response>;
deleteJson(url: string, content: any, params?: RequestInit): Promise<Response>;
}
8 changes: 4 additions & 4 deletions packages/bootstrap/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publishConfig": {
"registry": "https://nexus.eman.cz/repository/eman-npm/"
},
"version": "0.7.0",
"version": "0.7.1",
"description": "Bootstrap controls ready for Frui.ts integration",
"author": "Augustin Šulc <[email protected]>",
"license": "ISC",
Expand All @@ -24,9 +24,9 @@
"build": "tsc"
},
"dependencies": {
"@frui.ts/dirtycheck": "^0.7.0",
"@frui.ts/validation": "^0.7.0",
"@frui.ts/views": "^0.7.0",
"@frui.ts/dirtycheck": "^0.7.1",
"@frui.ts/validation": "^0.7.1",
"@frui.ts/views": "^0.7.1",
"bind-decorator": "^1.0.11",
"bootstrap": "^4.3.1",
"react-bootstrap": "^1.0.0-beta.12"
Expand Down
2 changes: 1 addition & 1 deletion packages/data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publishConfig": {
"registry": "https://nexus.eman.cz/repository/eman-npm/"
},
"version": "0.7.0",
"version": "0.7.1",
"description": "Helpers and interfaces for handling paged and sorted data sets",
"author": "Augustin Šulc <[email protected]>",
"license": "ISC",
Expand Down
12 changes: 6 additions & 6 deletions packages/datascreens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publishConfig": {
"registry": "https://nexus.eman.cz/repository/eman-npm/"
},
"version": "0.7.0",
"version": "0.7.1",
"description": "> TODO: description",
"author": "Augustin Šulc <[email protected]>",
"homepage": "",
Expand All @@ -25,10 +25,10 @@
"build": "tsc"
},
"dependencies": {
"@frui.ts/data": "^0.7.0",
"@frui.ts/dirtycheck": "^0.7.0",
"@frui.ts/helpers": "^0.7.0",
"@frui.ts/screens": "^0.7.0",
"@frui.ts/validation": "^0.7.0"
"@frui.ts/data": "^0.7.1",
"@frui.ts/dirtycheck": "^0.7.1",
"@frui.ts/helpers": "^0.7.1",
"@frui.ts/screens": "^0.7.1",
"@frui.ts/validation": "^0.7.1"
}
}
4 changes: 2 additions & 2 deletions packages/dirtycheck/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publishConfig": {
"registry": "https://nexus.eman.cz/repository/eman-npm/"
},
"version": "0.7.0",
"version": "0.7.1",
"description": "Observable dirty checking",
"author": "Augustin Šulc <[email protected]>",
"license": "ISC",
Expand All @@ -24,6 +24,6 @@
"build": "tsc"
},
"dependencies": {
"@frui.ts/helpers": "^0.7.0"
"@frui.ts/helpers": "^0.7.1"
}
}
2 changes: 1 addition & 1 deletion packages/helpers/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publishConfig": {
"registry": "https://nexus.eman.cz/repository/eman-npm/"
},
"version": "0.7.0",
"version": "0.7.1",
"description": "Frui.ts helper functions",
"keywords": [
"frui.ts"
Expand Down
4 changes: 2 additions & 2 deletions packages/screens/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publishConfig": {
"registry": "https://nexus.eman.cz/repository/eman-npm/"
},
"version": "0.7.0",
"version": "0.7.1",
"description": "Frui.ts screens",
"author": "Augustin Šulc <[email protected]>",
"license": "ISC",
Expand All @@ -24,7 +24,7 @@
"build": "tsc"
},
"dependencies": {
"@frui.ts/helpers": "^0.7.0",
"@frui.ts/helpers": "^0.7.1",
"query-string": "^6.9.0"
}
}
4 changes: 2 additions & 2 deletions packages/validation/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publishConfig": {
"registry": "https://nexus.eman.cz/repository/eman-npm/"
},
"version": "0.7.0",
"version": "0.7.1",
"description": "Observable validation",
"keywords": [
"mobx",
Expand All @@ -28,6 +28,6 @@
"build": "tsc"
},
"dependencies": {
"@frui.ts/helpers": "^0.7.0"
"@frui.ts/helpers": "^0.7.1"
}
}
6 changes: 3 additions & 3 deletions packages/views/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
"publishConfig": {
"registry": "https://nexus.eman.cz/repository/eman-npm/"
},
"version": "0.7.0",
"version": "0.7.1",
"description": "> TODO: description",
"author": "Augustin Šulc <[email protected]>",
"homepage": "",
Expand All @@ -25,7 +25,7 @@
"build": "tsc"
},
"dependencies": {
"@frui.ts/helpers": "^0.7.0",
"@frui.ts/screens": "^0.7.0"
"@frui.ts/helpers": "^0.7.1",
"@frui.ts/screens": "^0.7.1"
}
}
12 changes: 6 additions & 6 deletions stories/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@frui.ts/stories",
"private": true,
"version": "0.7.0",
"version": "0.7.1",
"description": "> TODO: description",
"author": "Augustin Šulc <[email protected]>",
"license": "ISC",
Expand All @@ -20,11 +20,11 @@
"prebuild": "rimraf dist"
},
"dependencies": {
"@frui.ts/bootstrap": "^0.7.0",
"@frui.ts/dirtycheck": "^0.7.0",
"@frui.ts/screens": "^0.7.0",
"@frui.ts/validation": "^0.7.0",
"@frui.ts/views": "^0.7.0",
"@frui.ts/bootstrap": "^0.7.1",
"@frui.ts/dirtycheck": "^0.7.1",
"@frui.ts/screens": "^0.7.1",
"@frui.ts/validation": "^0.7.1",
"@frui.ts/views": "^0.7.1",
"bootstrap": "^4.3.1",
"react-bootstrap": "^1.0.0-beta.12"
}
Expand Down

0 comments on commit b8387aa

Please sign in to comment.