Cleanup
This commit is contained in:
15
packages/shared/src/hooks/use-csrf-token.ts
Normal file
15
packages/shared/src/hooks/use-csrf-token.ts
Normal file
@@ -0,0 +1,15 @@
|
||||
import { useContext } from 'react';
|
||||
|
||||
import { CsrfTokenContext } from '@kit/contexts/csrf.context';
|
||||
|
||||
/**
|
||||
* @description Retrieves the current CSRF token in the CsrfTokenContext context
|
||||
* If not found, it will return an empty string. If required, the API will throw an error
|
||||
*/
|
||||
function useCsrfToken() {
|
||||
const token = useContext(CsrfTokenContext);
|
||||
|
||||
return token ?? '';
|
||||
}
|
||||
|
||||
export default useCsrfToken;
|
||||
Reference in New Issue
Block a user