Commit 330c8515 authored by Adrien HARNAY's avatar Adrien HARNAY Committed by Thibault Malbranche
Browse files

fix(networkHelpers): allow no token

Showing with 15 additions and 5 deletions
+15 -5
......@@ -5,7 +5,9 @@ const DEFAULT_NETWORK_HELPERS = {
method: 'GET',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${this.getToken()}`,
...(this.getToken && this.getToken()
? { Authorization: `Bearer ${this.getToken()}` }
: {}),
},
};
},
......@@ -14,8 +16,10 @@ const DEFAULT_NETWORK_HELPERS = {
method: 'PATCH',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${this.getToken()}`,
'Content-Type': 'application/json',
...(this.getToken && this.getToken()
? { Authorization: `Bearer ${this.getToken()}` }
: {}),
},
body: JSON.stringify(body),
};
......@@ -25,8 +29,10 @@ const DEFAULT_NETWORK_HELPERS = {
method: 'PUT',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${this.getToken()}`,
'Content-Type': 'application/json',
...(this.getToken && this.getToken()
? { Authorization: `Bearer ${this.getToken()}` }
: {}),
},
body: JSON.stringify(body),
};
......@@ -36,8 +42,10 @@ const DEFAULT_NETWORK_HELPERS = {
method: 'POST',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${this.getToken()}`,
'Content-Type': 'application/json',
...(this.getToken && this.getToken()
? { Authorization: `Bearer ${this.getToken()}` }
: {}),
},
body: JSON.stringify(body),
};
......@@ -47,7 +55,9 @@ const DEFAULT_NETWORK_HELPERS = {
method: 'DELETE',
headers: {
Accept: 'application/json',
Authorization: `Bearer ${this.getToken()}`,
...(this.getToken && this.getToken()
? { Authorization: `Bearer ${this.getToken()}` }
: {}),
},
};
},
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment