Unfollow tool for Bluesky

add service url input

Changed files
+19 -5
src
+19 -5
src/App.tsx
···
return follows;
};
-
const unfollowBsky = async (userHandle: any, userPassword: any) => {
const agent = new BskyAgent({
-
service: "https://bsky.social",
});
await agent.login({
identifier: userHandle,
password: userPassword,
});
-
-
setUnfollow("");
const followRecords = await fetchFollows(agent);
···
const UnfollowForm: Component = () => {
const [userHandle, setUserHandle] = createSignal();
const [appPassword, setAppPassword] = createSignal();
return (
<div>
<form>
<div>
<input
type="text"
···
</div>
<button
type="button"
-
onclick={() => unfollowBsky(userHandle(), appPassword())}
>
Unfollow
</button>
···
return follows;
};
+
const unfollowBsky = async (
+
userHandle: any,
+
userPassword: any,
+
serviceURL: any,
+
) => {
+
setUnfollow("");
+
const agent = new BskyAgent({
+
service: serviceURL,
});
await agent.login({
identifier: userHandle,
password: userPassword,
});
const followRecords = await fetchFollows(agent);
···
const UnfollowForm: Component = () => {
const [userHandle, setUserHandle] = createSignal();
const [appPassword, setAppPassword] = createSignal();
+
const [serviceURL, setserviceURL] = createSignal("https://bsky.social");
return (
<div>
<form>
+
<div>
+
<input
+
type="text"
+
placeholder="https://bsky.social (optional)"
+
onInput={(e) => setserviceURL(e.currentTarget.value)}
+
/>
+
</div>
<div>
<input
type="text"
···
</div>
<button
type="button"
+
onclick={() =>
+
unfollowBsky(userHandle(), appPassword(), serviceURL())
+
}
>
Unfollow
</button>