mirror of
https://github.com/danbulant/Portfolio
synced 2026-05-24 20:42:15 +00:00
fix: fix sanitize
This commit is contained in:
parent
8369b7dc93
commit
05387691e3
1 changed files with 8 additions and 5 deletions
|
|
@ -79,18 +79,21 @@ export const apiLogin = async (data: CandidateLogin): Promise<number> => {
|
|||
};
|
||||
|
||||
export const apiFillDetails = async (data: CandidateData): Promise<CandidateData> => {
|
||||
// Sanitize candidate data
|
||||
Object.keys(data.candidate).forEach((key) => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
data[key] = DOMPurify.sanitize(data[key]);
|
||||
data.candidate[key] = DOMPurify.sanitize(data.candidate[key]);
|
||||
});
|
||||
data.parents.forEach((parent) => {
|
||||
Object.keys(parent).forEach((key) => {
|
||||
// Sanitize parents data
|
||||
for (let index = 0; index < data.parents.length; index++) {
|
||||
Object.keys(data.parents[index]).forEach((key) => {
|
||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||
// @ts-ignore
|
||||
parent[key] = DOMPurify.sanitize(parent[key]);
|
||||
data.parents[index][key] = DOMPurify.sanitize(data.parents[index][key]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
console.log(data);
|
||||
try {
|
||||
const res = await axios.post(API_URL + '/candidate/details', data, { withCredentials: true });
|
||||
|
|
|
|||
Loading…
Reference in a new issue