Skip to content

Commit

Permalink
JSON:API Header
Browse files Browse the repository at this point in the history
  • Loading branch information
attus74 committed Nov 5, 2020
1 parent d927b83 commit 683c5db
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 7 deletions.
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,5 +77,10 @@ export class MyComponent implements OnInit {
return this.drupal.get(path, options);
}

loginUser(username: string, password: string): void {
// There is no direct answer, but you can subscribe the result, see getUserLoginStatus()
this.drupal.login(username, password);
}

}
```
24 changes: 17 additions & 7 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,20 +1,30 @@
{
"name": "@attus/drupal",
"version": "10.2.1",
"version": "10.2.2",
"description": "Drupal Service",
"homepage": "https://github.com/attus74/drupal",
"author": {
"name": "Attila Németh"
},
"author": "Attila Németh",
"repository": {
"type": "git",
"url": "https://github.com/attus74/drupal"
"url": "git+https://github.com/attus74/drupal.git"
},
"peerDependencies": {
"@angular/common": "^10.2",
"@angular/core": "^10.2"
},
"dependencies": {
"tslib": "^1.10.0"
}
}
},
"bugs": {
"url": "https://github.com/attus74/drupal/issues"
},
"main": "karma.conf.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [
"Drupal",
"Angular"
],
"license": "GPL-3.0"
}
4 changes: 4 additions & 0 deletions src/lib/model/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ export class DrupalHttpOptions {
this.headers = this.headers.set(name, value);
}

setJsonApiHeaders(): void {
this.headers = this.headers.set('Content-Type', 'application/vnd.api+json');
}

setParam(name: string, value: any): void {
if (this.params === null) {
this.params = new HttpParams();
Expand Down

0 comments on commit 683c5db

Please sign in to comment.