event.list.ts
920 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import { randomTransition } from "@src/components/page.transition";
import { renderApp } from "@src/App";
import {
getElement,
pendingFetch,
warningEmptyId,
fetchByURL,
} from "./functions";
export function linkEvent(e: Event) {
e.preventDefault();
const pathname: string = (e.target as HTMLAnchorElement).pathname.split(
"/"
)[1];
setTimeout(() => {
renderApp(pathname);
}, 1200);
randomTransition();
}
export async function searchEvent() {
const insta_id = (getElement("#id-input") as HTMLInputElement).value;
pendingFetch();
if (!insta_id) {
warningEmptyId();
return;
}
await fetchByURL("search?insta_id=" + insta_id);
}
export async function updateEvent() {
const insta_id = (getElement("#id-input") as HTMLInputElement).value;
pendingFetch();
if (!insta_id) {
warningEmptyId();
return;
}
await fetchByURL("update?insta_id=" + insta_id);
}