NathanWalker / nativescript-fancyalert

Fancy alerts for NativeScript.
Other
147 stars 38 forks source link

How to trigger the Fancy Alert based on API calls for every 5 seconds using setTimeout() ? #87

Open fvtrx opened 4 years ago

fvtrx commented 4 years ago

Hi!

I was wondering if there's any possible solutions for me to trigger the Fancy Alert based on API calls for every 5 seconds using setTimeout() method?

I want it to have like two-way notifications alert for two users which is: (Owner and Guest).

Once owner approve/reject guest request, guest will get alert notifications within the app that shows their request has been approved/rejected by the owner.

Framework used:

Nativescript-Vue

Steps to reproduce

  getGuestApprovalApi() {
     let url = "/selfcare/appointment-guest/appointment-guest-history";
     this.isApproved = true;
      api
        .get(url , {
          params: {
            uuid: this.uuid,
            filter: this.filter ? this.filter : null,
            sort_by: this.selectedKey,
            descending: this.selectedOrder === 0 ? "false" : "true",
            scan_type: this.selectedScanType,
          },
        })
        .then((response) => {
          console.log(response.data.data);
          TNSFancyAlert({
            "Approved",
           "Request approved",
           "OK"
          }).then(() => {
            setTimeout(() => (this.isApproved = false), 5000);
          });
      });
  },

Below are the planned output that I've designed:

Owner

iPhone 6-7-8 – 65 iPhone 6-7-8 – 91

Guest

iPhone 6-7-8 – 110 iPhone 6-7-8 – 111

Would be much appreciated that if there's anyone that could help me. Thanks!