feat(ntfy): add auth support
This commit is contained in:
18
packages/backend/src/apps/ntfy/common/add-auth-header.ts
Normal file
18
packages/backend/src/apps/ntfy/common/add-auth-header.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import { TBeforeRequest } from '@automatisch/types';
|
||||
|
||||
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
|
||||
if ($.auth.data.apiBaseUrl) {
|
||||
requestConfig.baseURL = $.auth.data.apiBaseUrl as string;
|
||||
}
|
||||
|
||||
if ($.auth.data?.username && $.auth.data?.password) {
|
||||
requestConfig.auth = {
|
||||
username: $.auth.data.username as string,
|
||||
password: $.auth.data.password as string,
|
||||
}
|
||||
}
|
||||
|
||||
return requestConfig;
|
||||
};
|
||||
|
||||
export default addAuthHeader;
|
Reference in New Issue
Block a user