igor-starostenko/report_factory-web

View on GitHub
src/api/api_helper.js

Summary

Maintainability
A
0 mins
Test Coverage
class ApiHelper {
  static verifyUrl(url) {
    if (!url || !url.includes('http')) {
      throw new Error(`Invalid API_URL: ${url}`);
    }
  }

  static formatUrl(url) {
    if (url) {
      if (url[url.length - 1] === '/') {
        return url;
      }
      return `${url}/`;
    }
    return '/';
  }
}

export default ApiHelper;