From 95df3522a15631abc51a4295cae0ea401a8d4e1e Mon Sep 17 00:00:00 2001 From: Markus Hatvan Date: Tue, 14 Sep 2021 19:58:52 +0200 Subject: feat: add eslint-plugin-unicorn (#1936) --- src/api/utils/auth.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'src/api/utils/auth.js') diff --git a/src/api/utils/auth.js b/src/api/utils/auth.js index e493b2962..527c68840 100644 --- a/src/api/utils/auth.js +++ b/src/api/utils/auth.js @@ -1,7 +1,11 @@ import localStorage from 'mobx-localstorage'; import { ferdiLocale, ferdiVersion } from '../../environment'; -export const prepareAuthRequest = (options = { method: 'GET' }, auth = true) => { +export const prepareAuthRequest = ( + // eslint-disable-next-line unicorn/no-object-as-default-parameter + options = { method: 'GET' }, + auth = true, +) => { const request = Object.assign(options, { mode: 'cors', headers: { @@ -16,12 +20,13 @@ export const prepareAuthRequest = (options = { method: 'GET' }, auth = true) => }); if (auth) { - request.headers.Authorization = `Bearer ${localStorage.getItem('authToken')}`; + request.headers.Authorization = `Bearer ${localStorage.getItem( + 'authToken', + )}`; } return request; }; -export const sendAuthRequest = (url, options, auth) => ( - window.fetch(url, prepareAuthRequest(options, auth)) -); +export const sendAuthRequest = (url, options, auth) => + window.fetch(url, prepareAuthRequest(options, auth)); -- cgit v1.2.3-70-g09d2