feat: Add SMS Integration & SMS Message Form.

This commit is contained in:
elforjani13
2021-11-07 13:39:29 +02:00
parent d26ef01afc
commit 834d365a97
28 changed files with 612 additions and 155 deletions

View File

@@ -125,7 +125,7 @@ export function useSettingCashFlow(props) {
}
/**
* Retrieve SMS settings.
* Retrieve SMS Notifications settings.
*/
export function useSettingSMSNotifications(props) {
return useRequestQuery(
@@ -138,3 +138,42 @@ export function useSettingSMSNotifications(props) {
},
);
}
/**
* Retrieve Specific SMS Notification settings.
*/
export function useSettingSMSNotification(key, props) {
return useRequestQuery(
[t.SETTING_SMS_NOTIFICATIONS, key],
{
method: 'get',
url: `settings/sms-notification/${key}`,
},
{
select: (res) => res.data.notification,
defaultData: {
smsNotification: [],
},
...props,
},
);
}
/**
* Retrieve Edit SMS Notification settings.
*/
export function useSettingEditSMSNotification(props) {
const queryClient = useQueryClient();
const apiRequest = useApiRequest();
return useMutation(
(values) => apiRequest.post(`settings/sms-notification`, values),
{
onSuccess: () => {
// Invalidate
queryClient.invalidateQueries([t.SETTING_SMS_NOTIFICATIONS]);
},
...props,
},
);
}

View File

@@ -111,7 +111,9 @@ const SETTING = {
SETTING_MANUAL_JOURNALS: 'SETTING_MANUAL_JOURNALS',
SETTING_ITEMS: 'SETTING_ITEMS',
SETTING_CASHFLOW: 'SETTING_CASHFLOW',
SETTING_SMS_NOTIFICATION: 'SETTING_SMS_NOTIFICATION',
SETTING_SMS_NOTIFICATIONS: 'SETTING_SMS_NOTIFICATIONS',
SETTING_EDIT_SMS_NOTIFICATION: 'SETTING_EDIT_SMS_NOTIFICATION',
};
const ORGANIZATIONS = {