autumn-js
Version:
Autumn JS Library
46 lines (42 loc) • 1.62 kB
JavaScript
"use client";
;
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/libraries/react/errorUtils/logAuthError.ts
var logAuthError_exports = {};
__export(logAuthError_exports, {
logAuthError: () => logAuthError
});
module.exports = __toCommonJS(logAuthError_exports);
var logAuthError = async (response) => {
if (response.status === 401) {
let clonedResponse = response.clone();
let data = await clonedResponse.json();
if (data.message.includes("Missing authorization header")) {
console.error(`[Autumn] Missing authorization header.
Use the getBearerToken prop in <AutumnProvider /> to set the authorization header.
https://docs.useautumn.com/quickstart/quickstart#5-set-up-autumnprovider`);
return true;
}
}
return false;
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
logAuthError
});