Sms factor done in simulate mode
This commit is contained in:
parent
869a30fac0
commit
70845595df
@ -5,26 +5,29 @@ import axios from "axios";
|
||||
|
||||
@Service()
|
||||
export default class SmsFactorService extends BaseService {
|
||||
|
||||
constructor(private variables: BackendVariables) {
|
||||
constructor(private variables: BackendVariables) {
|
||||
super();
|
||||
}
|
||||
|
||||
public async sendSms(phoneNumber: string, message: string): Promise<boolean> {
|
||||
axios.post('https://api.smsfactor.com/send/', {
|
||||
token: this.variables.SMS_FACTOR_TOKEN,
|
||||
sender: "LeCoffre",
|
||||
to: phoneNumber,
|
||||
text: message,
|
||||
}).then(response => {
|
||||
console.log('SMS sent successfully via Sms Factor :', response.data);
|
||||
return true;
|
||||
|
||||
})
|
||||
.catch(error => {
|
||||
console.error('Error sending Sms Factor SMS:', error.response.data);
|
||||
return false;
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
public async sendSms(phoneNumber: string, message: string): Promise<boolean> {
|
||||
axios
|
||||
.get(
|
||||
"https://api.smsfactor.com/send/simulate?to=" +
|
||||
phoneNumber +
|
||||
"&sender=LeCoffre&text=" +
|
||||
message +
|
||||
"token=" +
|
||||
this.variables.SMS_FACTOR_TOKEN,
|
||||
{},
|
||||
)
|
||||
.then((response) => {
|
||||
console.log("SMS sent successfully via Sms Factor:", response.status);
|
||||
return true;
|
||||
})
|
||||
.catch((error) => {
|
||||
console.error("Error sending Sms Factor SMS:", error);
|
||||
return false;
|
||||
});
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user