fix(5g-api): Authentication problem with location action

This commit is contained in:
Faruk AYDIN
2023-09-21 11:42:09 +02:00
parent 8f72c8c8fa
commit 9330e0976b
4 changed files with 24 additions and 3 deletions

View File

@@ -1,5 +1,5 @@
import verifyCredentials from './verify-credentials';
// import isStillVerified from './is-still-verified';
import isStillVerified from './is-still-verified';
// import refreshToken from './refresh-token';
export default {

View File

@@ -0,0 +1,8 @@
import { IGlobalVariable } from '@automatisch/types';
const isStillVerified = async ($: IGlobalVariable) => {
// const user = await getCurrentUser($);
return true;
};
export default isStillVerified;

View File

@@ -0,0 +1,13 @@
import { TBeforeRequest } from '@automatisch/types';
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
const { accessToken } = $.auth.data;
if (accessToken) {
requestConfig.headers.Authorization = `Bearer ${accessToken}`;
}
return requestConfig;
};
export default addAuthHeader;

View File

@@ -1,5 +1,5 @@
import defineApp from '../../helpers/define-app';
// import addAuthHeader from './common/add-auth-header';
import addAuthHeader from './common/add-auth-header';
import auth from './auth';
import actions from './actions';
@@ -12,7 +12,7 @@ export default defineApp({
baseUrl: 'https://developer.telekom.de',
apiBaseUrl: 'https://api.developer.telekom.de',
primaryColor: 'e20074',
// beforeRequest: [addAuthHeader],
beforeRequest: [addAuthHeader],
auth,
actions,
});