Add check for most common passwords

This commit is contained in:
Tuan Dang
2023-06-07 00:06:35 +01:00
parent c5be497052
commit a8ed187443
9 changed files with 1547 additions and 6 deletions
+2 -1
View File
@@ -2,5 +2,6 @@ export {
useGetAuthToken,
useSendMfaToken,
useVerifyMfaToken,
useRevokeAllSessions
useRevokeAllSessions,
useGetCommonPasswords
} from './queries'
+11 -2
View File
@@ -10,7 +10,8 @@ import {
VerifyMfaTokenRes} from './types';
const authKeys = {
getAuthToken: ['token'] as const
getAuthToken: ['token'] as const,
commonPasswords: ['common-passwords'] as const
};
export const useSendMfaToken = () => {
@@ -57,4 +58,12 @@ export const useRevokeAllSessions = () => {
return data;
}
});
}
}
const fetchCommonPasswords = async () => {
const { data } = await apiRequest.get('/api/v1/auth/common-passwords');
return data || [];
};
export const useGetCommonPasswords = () =>
useQuery({ queryKey: authKeys.commonPasswords, queryFn: fetchCommonPasswords });