mirror of
https://github.com/opelly27/streetmerchant.git
synced 2026-05-20 13:27:38 +00:00
refactor: doc and notification (#42)
Signed-off-by: Jef LeCompte <jeffreylec@gmail.com>
This commit is contained in:
@@ -3,11 +3,11 @@ import sendEmail from './email';
|
||||
import sendSlaskMessage from './slack';
|
||||
|
||||
export default function sendNotification(cartUrl: string) {
|
||||
if (Config.notificationMethods.toLocaleLowerCase().includes('email')) {
|
||||
if (Config.notifications.email.username && Config.notifications.email.password) {
|
||||
sendEmail(cartUrl);
|
||||
}
|
||||
|
||||
if (Config.notificationMethods.toLocaleLowerCase().includes('slack')) {
|
||||
if (Config.notifications.slack.channel && Config.notifications.slack.token) {
|
||||
sendSlaskMessage(cartUrl);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,8 +2,8 @@ import {WebClient} from '@slack/web-api';
|
||||
import {Config} from '../config';
|
||||
import {Logger} from '../logger';
|
||||
|
||||
const channel = Config.slack.channel ?? '';
|
||||
const token = Config.slack.token ?? '';
|
||||
const channel = Config.notifications.slack.channel;
|
||||
const token = Config.notifications.slack.token;
|
||||
const web = new WebClient(token);
|
||||
|
||||
export default function sendSlackMessage(text: string) {
|
||||
|
||||
Reference in New Issue
Block a user