mirror of
https://github.com/anotherhadi/iknowyou.git
synced 2026-04-12 00:47:26 +02:00
init enumerate
Signed-off-by: Hadi <112569860+anotherhadi@users.noreply.github.com>
This commit is contained in:
@@ -9,6 +9,8 @@
|
||||
let redirecting = $state(false);
|
||||
let redirectTarget = $state("");
|
||||
let demo = $state(false);
|
||||
let prefill = $state({ target: "", type: "" });
|
||||
let ready = $state(false);
|
||||
|
||||
onMount(async () => {
|
||||
loadSearches();
|
||||
@@ -20,10 +22,20 @@
|
||||
const params = new URLSearchParams(window.location.search);
|
||||
const target = params.get("target");
|
||||
const type = params.get("type");
|
||||
const fillOnly = params.get("fillOnly") === "true";
|
||||
|
||||
if (target && type) {
|
||||
// Clean URL before launching so a refresh doesn't re-trigger
|
||||
// Clean URL before acting so a refresh doesn't re-trigger
|
||||
window.history.replaceState({}, "", window.location.pathname);
|
||||
if (fillOnly) {
|
||||
prefill = { target, type };
|
||||
ready = true;
|
||||
return;
|
||||
}
|
||||
ready = true;
|
||||
await handleSearch(target, type, params.get("profile") || "default");
|
||||
} else {
|
||||
ready = true;
|
||||
}
|
||||
});
|
||||
|
||||
@@ -77,8 +89,8 @@
|
||||
Searching <span class="font-mono text-base-content/90">{redirectTarget}</span>...
|
||||
</p>
|
||||
</div>
|
||||
{:else}
|
||||
<SearchBar onSearch={handleSearch} {demo} />
|
||||
{:else if ready}
|
||||
<SearchBar onSearch={handleSearch} {demo} initialTarget={prefill.target} initialType={prefill.type} />
|
||||
{/if}
|
||||
</div>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user