Skip to content

Commit

Permalink
updated loading-container to take additional messages, updated login …
Browse files Browse the repository at this point in the history
…to redirect users back to where they wanted to go after logging in
  • Loading branch information
Exilliar committed Aug 31, 2023
1 parent 3fb7062 commit 8df59f7
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 8 deletions.
13 changes: 12 additions & 1 deletion src/components/shared/ErrorRetry.vue
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
<template>
<div class="d-flex align-center flex-column" style="width: 100%">
<p>Error</p>
<p v-if="errorMessage">{{ errorMessage }}</p>
<v-btn color="primary" style="color: black" @click="retry">Retry</v-btn>
<template v-if="!isDashboard">
<p class="mt-4">or</p>
<v-btn color="primary" style="color: black" href="/">Return to dashboard</v-btn>
</template>
</div>
</template>
<script lang="ts">
import { Vue, Component, Emit } from "vue-property-decorator";
import { Vue, Component, Prop, Emit } from "vue-property-decorator";
@Component
export default class ErrorRetry extends Vue {
@Prop() errorMessage!: string;
get isDashboard() {
return this.$route.name === "Landing";
}
@Emit("retry")
retry() {
return;
Expand Down
5 changes: 3 additions & 2 deletions src/components/shared/LoadingContainer.vue
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@
color="primary"
></v-progress-linear>
</div>
<error-retry v-else @retry="retry" />
<error-retry v-else :errorMessage="errorMessage" @retry="retry" />
</div>
</template>
<script lang="ts">
import { Vue, Component, Prop, Emit, Watch } from "vue-property-decorator";
import { Vue, Component, Prop, Emit } from "vue-property-decorator";
import LoadingSpinner from "./LoadingSpinner.vue";
import ErrorRetry from "./ErrorRetry.vue";
Expand All @@ -26,6 +26,7 @@ import ErrorRetry from "./ErrorRetry.vue";
export default class LoadingContainer extends Vue {
@Prop() loading!: boolean;
@Prop() error!: boolean;
@Prop() errorMessage!: string;
@Prop() line!: boolean;
get loaded() {
Expand Down
5 changes: 5 additions & 0 deletions src/router/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,11 @@ router.beforeEach(async (to, from, next) => {
next();
}
}
else {
if (to.fullPath !== "/") {
localStorage.setItem("redirect-path", to.fullPath);
}
}
next("/login");
} else next("/");
}
Expand Down
14 changes: 9 additions & 5 deletions src/views/StreamReports.vue
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<template>
<v-main class="mr-7 ml-7 pb-4">
<loading-container :error="error" :loading="loading" @retry="loadStreams">
<loading-container
:error="error"
errorMessage="Stream not found, make sure you are signed into the correct server"
:loading="loading"
@retry="loadStreams"
>
<template v-slot="{ loaded }">
<v-container v-if="loaded">
<v-data-iterator
Expand Down Expand Up @@ -192,9 +197,7 @@ export default class StreamReports extends Vue {
// this.quickBranchName = branchName;
// this.quickReport = true;
// this.$router.push({ name: "UpdateAssessmentBranch"})
this.$router.push(
`assessment/${this.streamid}/${branchName}`
);
this.$router.push(`assessment/${this.streamid}/${branchName}`);
}
quickReportClose() {
this.quickReport = false;
Expand Down Expand Up @@ -258,7 +261,8 @@ export default class StreamReports extends Vue {
} else {
this.snackTimeout = 30000;
this.deleteSuccess = false;
this.deleteSnackTextError = "Something went wrong:" + deleted.errors[0].message;
this.deleteSnackTextError =
"Something went wrong:" + deleted.errors[0].message;
this.deleteSnack = true;
}
} catch (err) {
Expand Down

0 comments on commit 8df59f7

Please sign in to comment.