added device type header to requests
This commit is contained in:
parent
21963cb9d3
commit
58481633eb
|
@ -75,7 +75,8 @@ export default class MainBackground {
|
||||||
this.cryptoService = new CryptoService();
|
this.cryptoService = new CryptoService();
|
||||||
this.tokenService = new TokenService();
|
this.tokenService = new TokenService();
|
||||||
this.appIdService = new AppIdService();
|
this.appIdService = new AppIdService();
|
||||||
this.apiService = new ApiService(this.tokenService, (expired: boolean) => this.logout(expired));
|
this.apiService = new ApiService(this.tokenService, this.utilsService,
|
||||||
|
(expired: boolean) => this.logout(expired));
|
||||||
this.environmentService = new EnvironmentService(this.apiService);
|
this.environmentService = new EnvironmentService(this.apiService);
|
||||||
this.userService = new UserService(this.tokenService);
|
this.userService = new UserService(this.tokenService);
|
||||||
this.settingsService = new SettingsService(this.userService);
|
this.settingsService = new SettingsService(this.userService);
|
||||||
|
|
|
@ -34,7 +34,8 @@ export default class ApiService {
|
||||||
identityBaseUrl: string;
|
identityBaseUrl: string;
|
||||||
logoutCallback: Function;
|
logoutCallback: Function;
|
||||||
|
|
||||||
constructor(private tokenService: TokenService, logoutCallback: Function) {
|
constructor(private tokenService: TokenService, private utilsService: UtilsService,
|
||||||
|
logoutCallback: Function) {
|
||||||
this.logoutCallback = logoutCallback;
|
this.logoutCallback = logoutCallback;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +86,7 @@ export default class ApiService {
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
}));
|
}));
|
||||||
|
@ -124,6 +126,7 @@ export default class ApiService {
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
}));
|
}));
|
||||||
|
@ -141,8 +144,9 @@ export default class ApiService {
|
||||||
const response = await fetch(new Request(this.baseUrl + '/accounts/revision-date', {
|
const response = await fetch(new Request(this.baseUrl + '/accounts/revision-date', {
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
Accept: 'application/json',
|
'Accept': 'application/json',
|
||||||
Authorization: authHeader,
|
'Authorization': authHeader,
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -160,6 +164,7 @@ export default class ApiService {
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
}));
|
}));
|
||||||
|
@ -176,6 +181,7 @@ export default class ApiService {
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
}));
|
}));
|
||||||
|
@ -197,6 +203,7 @@ export default class ApiService {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Authorization': authHeader,
|
'Authorization': authHeader,
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
}));
|
}));
|
||||||
|
@ -219,6 +226,7 @@ export default class ApiService {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Authorization': authHeader,
|
'Authorization': authHeader,
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
}));
|
}));
|
||||||
|
@ -237,7 +245,8 @@ export default class ApiService {
|
||||||
const response = await fetch(new Request(this.baseUrl + '/folders/' + id, {
|
const response = await fetch(new Request(this.baseUrl + '/folders/' + id, {
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
Authorization: authHeader,
|
'Authorization': authHeader,
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
}));
|
}));
|
||||||
|
@ -259,6 +268,7 @@ export default class ApiService {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Authorization': authHeader,
|
'Authorization': authHeader,
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
}));
|
}));
|
||||||
|
@ -281,6 +291,7 @@ export default class ApiService {
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
'Authorization': authHeader,
|
'Authorization': authHeader,
|
||||||
'Content-Type': 'application/json; charset=utf-8',
|
'Content-Type': 'application/json; charset=utf-8',
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
method: 'PUT',
|
method: 'PUT',
|
||||||
}));
|
}));
|
||||||
|
@ -299,7 +310,8 @@ export default class ApiService {
|
||||||
const response = await fetch(new Request(this.baseUrl + '/ciphers/' + id, {
|
const response = await fetch(new Request(this.baseUrl + '/ciphers/' + id, {
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
Authorization: authHeader,
|
'Authorization': authHeader,
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
}));
|
}));
|
||||||
|
@ -318,8 +330,9 @@ export default class ApiService {
|
||||||
body: data,
|
body: data,
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
Accept: 'application/json',
|
'Accept': 'application/json',
|
||||||
Authorization: authHeader,
|
'Authorization': authHeader,
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
}));
|
}));
|
||||||
|
@ -338,7 +351,8 @@ export default class ApiService {
|
||||||
const response = await fetch(new Request(this.baseUrl + '/ciphers/' + id + '/attachment/' + attachmentId, {
|
const response = await fetch(new Request(this.baseUrl + '/ciphers/' + id + '/attachment/' + attachmentId, {
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
Authorization: authHeader,
|
'Authorization': authHeader,
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
method: 'DELETE',
|
method: 'DELETE',
|
||||||
}));
|
}));
|
||||||
|
@ -356,8 +370,9 @@ export default class ApiService {
|
||||||
const response = await fetch(new Request(this.baseUrl + '/sync', {
|
const response = await fetch(new Request(this.baseUrl + '/sync', {
|
||||||
cache: 'no-cache',
|
cache: 'no-cache',
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
Accept: 'application/json',
|
'Accept': 'application/json',
|
||||||
Authorization: authHeader,
|
'Authorization': authHeader,
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
@ -415,6 +430,7 @@ export default class ApiService {
|
||||||
headers: new Headers({
|
headers: new Headers({
|
||||||
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
'Content-Type': 'application/x-www-form-urlencoded; charset=utf-8',
|
||||||
'Accept': 'application/json',
|
'Accept': 'application/json',
|
||||||
|
'Device-Type': this.utilsService.getBrowser(),
|
||||||
}),
|
}),
|
||||||
method: 'POST',
|
method: 'POST',
|
||||||
}));
|
}));
|
||||||
|
|
Loading…
Reference in New Issue