1
0
mirror of https://github.com/Unleash/unleash.git synced 2025-01-01 00:08:27 +01:00
unleash.unleash/frontend/src/hooks/useSubmittedFeedback.ts
2024-01-04 14:10:01 +02:00

18 lines
648 B
TypeScript

import { useEffect, useState } from 'react';
import { getLocalStorageItem, setLocalStorageItem } from '../utils/storage';
import { basePath } from 'utils/formatPath';
import { createLocalStorage } from '../utils/createLocalStorage';
export type IFeedbackCategory = 'search' | 'newStrategyForm';
export const useUserSubmittedFeedback = (category: IFeedbackCategory) => {
const key = `unleash-userSubmittedFeedback:${category}`;
const { value: hasSubmittedFeedback, setValue: setHasSubmittedFeedback } =
createLocalStorage<Boolean>(key, false);
return {
hasSubmittedFeedback,
setHasSubmittedFeedback,
};
};