Show error message if moving of followers fails
This commit is contained in:
parent
2be8e2baa0
commit
6852c69498
4 changed files with 32 additions and 9 deletions
|
@ -9,6 +9,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
||||||
### Added
|
### Added
|
||||||
|
|
||||||
- Added "Experiments" section to Settings page (includes "Move Followers" feature).
|
- Added "Experiments" section to Settings page (includes "Move Followers" feature).
|
||||||
|
- Show error message if moving of followers fails.
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
|
|
|
@ -126,8 +126,13 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
@mixin content-form {
|
@mixin content-form {
|
||||||
|
align-items: flex-start;
|
||||||
|
display: flex;
|
||||||
|
flex-direction: column;
|
||||||
|
gap: $block-outer-padding;
|
||||||
|
|
||||||
.input-group {
|
.input-group {
|
||||||
margin-bottom: $block-outer-padding;
|
width: 100%;
|
||||||
|
|
||||||
label {
|
label {
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -148,4 +153,8 @@
|
||||||
width: 100%;
|
width: 100%;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.error-message {
|
||||||
|
color: $error-color;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<input
|
<input
|
||||||
type="text"
|
type="text"
|
||||||
id="from-actor-id"
|
id="from-actor-id"
|
||||||
placeholder="From actor ID"
|
placeholder="From (actor ID)"
|
||||||
v-model="fromActorId"
|
v-model="fromActorId"
|
||||||
>
|
>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,11 +22,12 @@
|
||||||
<button
|
<button
|
||||||
type="submit"
|
type="submit"
|
||||||
class="btn"
|
class="btn"
|
||||||
:disabled="!canMove()"
|
:disabled="!canMove() || isLoading"
|
||||||
@click.prevent="move()"
|
@click.prevent="move()"
|
||||||
>
|
>
|
||||||
Move
|
Move
|
||||||
</button>
|
</button>
|
||||||
|
<div class="error-message" v-if="errorMessage">{{ errorMessage }}</div>
|
||||||
</form>
|
</form>
|
||||||
</template>
|
</template>
|
||||||
</sidebar-layout>
|
</sidebar-layout>
|
||||||
|
@ -45,6 +46,8 @@ const { currentUser, ensureAuthToken, setCurrentUser } = $(useCurrentUser())
|
||||||
|
|
||||||
const fromActorId = $ref("")
|
const fromActorId = $ref("")
|
||||||
const followersCsv = $ref("")
|
const followersCsv = $ref("")
|
||||||
|
let isLoading = $ref(false)
|
||||||
|
let errorMessage = $ref<string | null>(null)
|
||||||
|
|
||||||
function canMove(): boolean {
|
function canMove(): boolean {
|
||||||
return fromActorId.length > 0 && followersCsv.length > 0
|
return fromActorId.length > 0 && followersCsv.length > 0
|
||||||
|
@ -54,11 +57,21 @@ async function move() {
|
||||||
if (currentUser === null) {
|
if (currentUser === null) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const user = await moveFollowers(
|
let user
|
||||||
ensureAuthToken(),
|
isLoading = true
|
||||||
fromActorId,
|
try {
|
||||||
followersCsv,
|
user = await moveFollowers(
|
||||||
)
|
ensureAuthToken(),
|
||||||
|
fromActorId,
|
||||||
|
followersCsv,
|
||||||
|
)
|
||||||
|
} catch (error: any) {
|
||||||
|
isLoading = false
|
||||||
|
errorMessage = error.message
|
||||||
|
return
|
||||||
|
}
|
||||||
|
isLoading = false
|
||||||
|
errorMessage = null
|
||||||
setCurrentUser(user)
|
setCurrentUser(user)
|
||||||
router.push({ name: "profile", params: { profileId: currentUser.id } })
|
router.push({ name: "profile", params: { profileId: currentUser.id } })
|
||||||
}
|
}
|
||||||
|
|
|
@ -224,7 +224,7 @@ async function save() {
|
||||||
display: grid;
|
display: grid;
|
||||||
gap: $input-padding;
|
gap: $input-padding;
|
||||||
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
|
||||||
margin-bottom: $block-outer-padding;
|
width: 100%;
|
||||||
|
|
||||||
.input-group:last-child {
|
.input-group:last-child {
|
||||||
margin-bottom: 0;
|
margin-bottom: 0;
|
||||||
|
|
Loading…
Reference in a new issue