aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/rocketchat/index.js
blob: a89bd615d85c37f120bc9d4ccf998f3ee25eaa2a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
module.exports = Ferdium =>
  class RocketChat extends Ferdium {
    async validateUrl(url) {
      try {
        const resp = await window.fetch(url, {
          method: 'GET',
          headers: {
            'Content-Type': 'application/json',
          },
        });
        const status = resp.status.toString();
        return status.startsWith('2') || status.startsWith('3');
      } catch (error) {
        console.error(error);
      }

      return false;
    }
  };