mirror of
https://github.com/Unleash/unleash.git
synced 2025-01-06 00:07:44 +01:00
70600552d2
This PR adds the feedback form to the new create / edit strategy form behind a feature flag. * Add feedback form * Minor refactor to useFeedback
18 lines
660 B
TypeScript
18 lines
660 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 = `${basePath}:unleash-userSubmittedFeedback:${category}`;
|
|
|
|
const { value: hasSubmittedFeedback, setValue: setHasSubmittedFeedback } =
|
|
createLocalStorage<Boolean>(key, false);
|
|
return {
|
|
hasSubmittedFeedback,
|
|
setHasSubmittedFeedback,
|
|
};
|
|
};
|