feat(customers): add optional group assignees with OR visibility for people, companies, and birthdays
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
@@ -122,17 +122,27 @@ function apiMessage(e: unknown, fallback: string) {
|
||||
return fallback;
|
||||
}
|
||||
|
||||
async function send() {
|
||||
async function send(force = false) {
|
||||
if (!props.endpoint || busy.value || done.value) return;
|
||||
busy.value = true;
|
||||
error.value = '';
|
||||
try {
|
||||
await api.post(props.endpoint, { text: text.value });
|
||||
await api.post(props.endpoint, { text: text.value, ...(force ? { force: true } : {}) });
|
||||
done.value = 'پیامک ارسال شد.';
|
||||
emit('sent');
|
||||
void loadHistory();
|
||||
} catch (e) {
|
||||
error.value = apiMessage(e, 'ارسال پیامک ناموفق بود.');
|
||||
if (axios.isAxiosError(e) && e.response?.status === 409) {
|
||||
const msg = apiMessage(e, 'قبلاً پیامک تبریک فرستاده شده است. دوباره بفرستیم؟');
|
||||
if (confirm(msg)) {
|
||||
busy.value = false;
|
||||
await send(true);
|
||||
return;
|
||||
}
|
||||
error.value = msg;
|
||||
} else {
|
||||
error.value = apiMessage(e, 'ارسال پیامک ناموفق بود.');
|
||||
}
|
||||
} finally {
|
||||
busy.value = false;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user