feat(wordpress): add auth and new post trigger (#1160)

This commit is contained in:
Ali BARIN
2023-08-09 22:34:21 +02:00
committed by GitHub
parent 5046c4c911
commit ec42446daa
19 changed files with 284 additions and 0 deletions

View File

@@ -0,0 +1,17 @@
import { TBeforeRequest } from '@automatisch/types';
const addAuthHeader: TBeforeRequest = ($, requestConfig) => {
const userLogin = $.auth.data.userLogin as string;
const password = $.auth.data.password as string;
if (userLogin && password) {
requestConfig.auth = {
username: userLogin,
password,
};
}
return requestConfig;
};
export default addAuthHeader;

View File

@@ -0,0 +1,7 @@
import { IGlobalVariable } from '@automatisch/types';
const getInstanceUrl = ($: IGlobalVariable): string => {
return $.auth.data.instanceUrl as string;
};
export default getInstanceUrl;

View File

@@ -0,0 +1,12 @@
import { TBeforeRequest } from '@automatisch/types';
const setBaseUrl: TBeforeRequest = ($, requestConfig) => {
const instanceUrl = $.auth.data.instanceUrl as string;
if (instanceUrl) {
requestConfig.baseURL = instanceUrl;
}
return requestConfig;
};
export default setBaseUrl;