Skip to content

Commit

Permalink
Updates
Browse files Browse the repository at this point in the history
  • Loading branch information
catherineisonline committed Jul 26, 2024
1 parent 1349595 commit 2143640
Show file tree
Hide file tree
Showing 163 changed files with 18,822 additions and 56 deletions.
15 changes: 6 additions & 9 deletions app.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,9 @@ shortlyBtn.addEventListener("click", (e) => {
}
});
function fetchBackupUrl(inputValue) {
fetch(`https://ulvis.net/API/write/get?url=${encodeURIComponent(inputValue)}`)
.then((response) => response.json())
fetch(`http://localhost:3000/shortener?inputValue=${encodeURIComponent(inputValue)}`).then((response) => response.json())
.then((response) => {
if (response.data) {
console.log(response.data)
if (response.success) {
let shortlyCode = response.data.url;
resultSkeleton = `<div class="result">
<p class="inserted-link">${inputValue}</p>
Expand All @@ -57,17 +55,16 @@ function fetchBackupUrl(inputValue) {
<button class="copy-btn">Copy</button>
</div>
</div>`;
// Check if I have some storage and show results from it

if (sessionStorage.getItem("resultsStorage") !== null) {
resultStorage = [resultSkeleton, sessionStorage.getItem("resultsStorage")].reverse();
resultStorage = [resultSkeleton, sessionStorage.getItem("resultsStorage")]
parentNode.innerHTML = [resultStorage].join('').split(',').join('');
sessionStorage.setItem("resultsStorage", [resultStorage].join('').split(',').join(''));
resetResults.classList.add("active");
}
// If I don't have storage just show the first/current result
else {
parentNode.innerHTML = resultSkeleton;
// Then push this first result to my storage and then session storage
parentNode.insertAdjacentHTML('afterbegin', resultSkeleton);

resultStorage.push(resultSkeleton);
sessionStorage.setItem("resultsStorage", [resultStorage].join('').split(',').join(''));
resetResults.classList.add("active");
Expand Down
1 change: 0 additions & 1 deletion app.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,6 @@ shortlyBtn.addEventListener("click", (e) => {
parentNode.innerHTML = resultSkeleton;
//then push this first result to my storage and then session storage
resultStorage.push(resultSkeleton);
console.log(resultSkeleton);
sessionStorage.setItem("resultsStorage", [resultStorage].join('').split(',').join(''));
resetResults.classList.add("active");
}
Expand Down
1 change: 0 additions & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
integrity="sha512-9usAa10IRO0HhonpyAIVpjrylPvoDwiPUiKdWk5t3PyolY1cOd4DSE0Ga+ri4AuTroPR5aQvXU9xC6qOPnzFeg=="
crossorigin="anonymous" referrerpolicy="no-referrer" />
<link rel="stylesheet" href="styles.css">

<title>Frontend Mentor | Shortly URL shortening API Challenge</title>
</head>

Expand Down
26 changes: 0 additions & 26 deletions inject-env.js

This file was deleted.

21 changes: 21 additions & 0 deletions node_modules/@types/http-proxy/LICENSE

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions node_modules/@types/http-proxy/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

250 changes: 250 additions & 0 deletions node_modules/@types/http-proxy/index.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 2143640

Please sign in to comment.