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

      return false;
    }
  };