added authorization by token
This commit is contained in:
@@ -23,9 +23,13 @@ function handleRequest(method, url, attempts, body) {
|
||||
function request(method, url, body) {
|
||||
let controller = new AbortController;
|
||||
let requestOptions = {};
|
||||
if (!registrationStore.tokenKey) return Promise.reject();
|
||||
if (method === 'GET' || method === 'DELETE'){
|
||||
requestOptions = {
|
||||
method: method,
|
||||
headers: {
|
||||
Authorization: `Token ${registrationStore.tokenKey}`,
|
||||
},
|
||||
signal: controller.signal,
|
||||
}
|
||||
};
|
||||
@@ -33,6 +37,7 @@ function request(method, url, body) {
|
||||
requestOptions = {
|
||||
method: method,
|
||||
headers: {
|
||||
Authorization: `Token ${registrationStore.tokenKey}`,
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user