2023-12-29 09:08:19 +01:00
|
|
|
import { useEffect, useState } from 'react';
|
|
|
|
import { getLocalStorageItem, setLocalStorageItem } from '../utils/storage';
|
|
|
|
import { basePath } from 'utils/formatPath';
|
2023-12-29 12:19:08 +01:00
|
|
|
import { createLocalStorage } from '../utils/createLocalStorage';
|
2023-12-29 09:08:19 +01:00
|
|
|
|
2024-01-03 15:43:22 +01:00
|
|
|
export type IFeedbackCategory = 'search' | 'newStrategyForm';
|
2023-12-29 09:08:19 +01:00
|
|
|
|
|
|
|
export const useUserSubmittedFeedback = (category: IFeedbackCategory) => {
|
2024-01-04 13:10:01 +01:00
|
|
|
const key = `unleash-userSubmittedFeedback:${category}`;
|
2023-12-29 09:08:19 +01:00
|
|
|
|
2023-12-29 12:19:08 +01:00
|
|
|
const { value: hasSubmittedFeedback, setValue: setHasSubmittedFeedback } =
|
|
|
|
createLocalStorage<Boolean>(key, false);
|
2023-12-29 09:08:19 +01:00
|
|
|
return {
|
|
|
|
hasSubmittedFeedback,
|
|
|
|
setHasSubmittedFeedback,
|
|
|
|
};
|
|
|
|
};
|