OlliL / moneyjinn-client

BSD 2-Clause "Simplified" License
2 stars 0 forks source link

Consider Axios + OpenAPI #27

Closed OlliL closed 1 year ago

OlliL commented 1 year ago

Consider replacing fetch() API with axios

axios

      // Add xsrf header
      // This is only done if running in a standard browser environment.
      // Specifically not if we're in a web worker, or react-native.
      if (platform.isStandardBrowserEnv) {
        // Add xsrf header
        var xsrfValue = (config.withCredentials || isURLSameOrigin(fullPath)) && config.xsrfCookieName && cookies.read(config.xsrfCookieName);
        if (xsrfValue) {
          requestHeaders.set(config.xsrfHeaderName, xsrfValue);
        }
      }

openapi

OlliL commented 1 year ago
    read: function read(name) {
      const match = document.cookie.match(new RegExp("(^|;\\s*)(" + name + ")=([^;]*)"));
      return match ? decodeURIComponent(match[3]) : null;
    },