aboutsummaryrefslogtreecommitdiffstats
path: root/recipes/rocketchat/index.js
blob: a7fee29001fe67b1d8645c0ff096a37fbe165b6d (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
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;
  }
};