pages rename

This commit is contained in:
Victor Batischev
2024-02-14 19:32:13 +03:00
parent 0fc8f68c79
commit 140adb0051
22 changed files with 36 additions and 31 deletions

View File

@ -2,34 +2,33 @@ export function createMarkup(text) {
return { __html: text.split("</p>").join("</p>") };
}
// export function transformHtml(text) {
// let startHtml = {
// __html: text.split("<h3> || <h2>").join("<br><h2>").split("<br>"),
// };
// startHtml = startHtml.__html.filter(
// (el) => (el !== null && el !== "") || el === 0
// );
// const finalHtml = startHtml.map(
// (item) =>
// `<div class='experience__block'>
// <div class="summary__sections__head">
// <h3>Описание опыта работы</h3>
// <button>Редактировать</button>
// </div>
// <div class="experience__content">${item.split("<h3>")[0]}</div>
// </div>`
// );
// return { __html: finalHtml.join("") };
// }
//
// export const setToken = () => {
// const url = new URL(window.location.href);
// const urlT = url.searchParams.get("token");
// urlT ? sessionStorage.setItem('token', 'Bearer ' + urlT) : '';
// const tParam = urlT || sessionStorage.getItem('token');
// return tParam ? {"Authorization": tParam} : false
//
// };
export function transformHtml(text) {
let startHtml = {
__html: text.split("<h3> || <h2>").join("<br><h2>").split("<br>")
};
startHtml = startHtml.__html.filter(
(el) => (el !== null && el !== "") || el === 0
);
const finalHtml = startHtml.map(
(item) =>
`<div class='experience__block'>
<div class="summary__sections__head">
<h3>Описание опыта работы</h3>
<button>Редактировать</button>
</div>
<div class="experience__content">${item.split("<h3>")[0]}</div>
</div>`
);
return { __html: finalHtml.join("") };
}
export const setToken = () => {
const url = new URL(window.location.href);
const urlT = url.searchParams.get("token");
urlT ? sessionStorage.setItem("token", "Bearer " + urlT) : "";
const tParam = urlT || sessionStorage.getItem("token");
return tParam ? { Authorization: tParam } : false;
};
export const getToken = () => {
const tParam = `Bearer ${localStorage.getItem("auth_token")}`;