feat(flowers-software): add app with authentication

This commit is contained in:
Ali BARIN
2022-12-15 00:46:42 +01:00
parent f30ac46672
commit 7175d92eaf
8 changed files with 124 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import { IGlobalVariable } from '@automatisch/types';
import getWebhooks from '../common/get-webhooks';
const verifyCredentials = async ($: IGlobalVariable) => {
const response = await getWebhooks($);
const successful = Array.isArray(response.data);
if (!successful) {
throw new Error('Failed while authorizing!');
}
await $.auth.set({
screenName: $.auth.data.username,
username: $.auth.data.username,
password: $.auth.data.password,
apiKey: $.auth.data.apiKey,
});
};
export default verifyCredentials;