Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
notifyPasses(aheadMin = 5) {
if (!this.groundStationAvailable) {
Toast.open({
message: "Ground station required to notify for passes",
type: "is-warning",
position: "is-bottom",
duration: 4000,
});
return;
}
let passes = this.orbit.computePasses(this.groundStationPosition);
if (!passes) {
Toast.open({
message: `No passes for ${this.name}`,
type: "is-warning",
position: "is-bottom",
duration: 4000,
});
return;
}
passes.forEach((pass) => {
let start = dayjs(pass.start).startOf("second");
this.pm.notifyAtDate(start.subtract(aheadMin, "minute"), `${pass.name} pass in ${aheadMin} minutes`);
this.pm.notifyAtDate(start, `${pass.name} pass starting now`);
//this.pm.notifyAtDate(dayjs().add(5, "second"), `${pass.name} test pass in ${aheadMin} minutes`);
});
Toast.open({
message: `Notifying for passes of ${this.name}`,
export function flashMessage(content: string, isError?: boolean) {
const toastType = isError ? 'is-danger' : 'is-success';
const duration = 3000;
const position = 'is-bottom-right';
Toast.open({ type: toastType, position: position, duration: duration, message: content });
}
}, function (error) {
if (error.response.data.message === 'The CSRF token has expired') {
Snackbar.open({
message: error.response.data.message,
type: 'is-white',
position: 'is-top',
actionText: 'Refresh',
indefinite: true,
onAction: () => {
location.reload()
}}
)
} else {
Toast.open(error.response.data.message)
}
return Promise.reject(error);
});