mirror of
https://github.com/danbulant/Portfolio
synced 2026-06-07 16:50:13 +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> => {
|
export const apiFillDetails = async (data: CandidateData): Promise<CandidateData> => {
|
||||||
|
// Sanitize candidate data
|
||||||
Object.keys(data.candidate).forEach((key) => {
|
Object.keys(data.candidate).forEach((key) => {
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
data[key] = DOMPurify.sanitize(data[key]);
|
data.candidate[key] = DOMPurify.sanitize(data.candidate[key]);
|
||||||
});
|
});
|
||||||
data.parents.forEach((parent) => {
|
// Sanitize parents data
|
||||||
Object.keys(parent).forEach((key) => {
|
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
|
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
parent[key] = DOMPurify.sanitize(parent[key]);
|
data.parents[index][key] = DOMPurify.sanitize(data.parents[index][key]);
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
|
||||||
console.log(data);
|
console.log(data);
|
||||||
try {
|
try {
|
||||||
const res = await axios.post(API_URL + '/candidate/details', data, { withCredentials: true });
|
const res = await axios.post(API_URL + '/candidate/details', data, { withCredentials: true });
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue