fix: fixes formbricks.logout (#4672)

This commit is contained in:
Anshuman Pandey
2025-01-28 16:52:49 +05:30
committed by GitHub
parent ec29abfcaf
commit 24de1559a5
3 changed files with 11 additions and 3 deletions

View File

@@ -54,6 +54,13 @@ export const fetchPersonState = async (
responseMessage: jsonRes.message,
});
if (error.error.code === "forbidden") {
logger.error(
// eslint-disable-next-line @typescript-eslint/no-unnecessary-condition -- we want to log the error message if it exists
error.error.responseMessage ?? "User identification is not available for this environment"
);
}
throw new Error(error.error.message);
}

View File

@@ -9,9 +9,10 @@ const config = Config.getInstance();
const logger = Logger.getInstance();
// eslint-disable-next-line @typescript-eslint/require-await -- There are no promises but our proxy makes the functions async
export const logoutPerson = async (): Promise<void> => {
export const logoutPerson = async (): Promise<Result<void, NetworkError>> => {
deinitalize();
config.resetConfig();
return okVoid();
};
export const resetPerson = async (): Promise<Result<void, NetworkError>> => {

View File

@@ -57,8 +57,8 @@ export function SurveyModal({
onFinished?.();
setTimeout(
() => {
const firstEnabledEnding = survey.endings[0];
if (firstEnabledEnding.type !== "redirectToUrl") {
const firstEnabledEnding = survey.endings?.[0];
if (firstEnabledEnding?.type !== "redirectToUrl") {
close();
}
},