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

    return false;
  }
};