Skip to content
This repository has been archived by the owner on Jan 26, 2025. It is now read-only.

Commit

Permalink
refactor(manager): improve totps component
Browse files Browse the repository at this point in the history
- change errors div by the global toast component
  • Loading branch information
AllanOricil committed Jan 3, 2025
1 parent 15b7681 commit c09d25f
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions site/components/totps.vue
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,27 @@
<Totp :service="service"></Totp>
</div>
</draggable>
<div v-if="errorMessage" class="alert alert-danger mt-3" role="alert">
{{ errorMessage }}
</div>
</template>

<script lang="ts" setup>
import { ref, onBeforeMount } from "vue";
import { ref, onBeforeMount, inject } from "vue";
import { VueDraggableNext } from "vue-draggable-next";
import Totp from "~/components/totp.vue";
import ESP32MFAAuthenticatorClient from "@/api/esp32-mfa-authenticator-client";
const name = "totps";
const services = ref([]);
const errorMessage = ref(null);
const showToast = inject("showToast") as Function;
onBeforeMount(async () => {
try {
const client = new ESP32MFAAuthenticatorClient();
services.value = await client.fetchServices();
} catch (error) {
errorMessage.value = "Could not fetch services";
console.error("Error while fetching services:", error);
showToast("Could not load services");
}
});
const draggable = VueDraggableNext;
Expand Down

0 comments on commit c09d25f

Please sign in to comment.