github.com/benoitkugler/goacve@v0.0.0-20201217100549-151ce6e55dc8/server/frontend/bv/src/pages/notification/App.vue (about)

     1  <template>
     2    <base-app :title="title">
     3      <b-container class="my-5 mb-4">
     4        <b-alert
     5          :variant="isError ? 'danger' : 'success'"
     6          v-if="notification != null"
     7          show
     8        >
     9          <div v-if="isError">
    10            <p>Une <b>erreur</b> est survenue suite à votre requête.</p>
    11            <div v-html="notification.error.content"></div>
    12          </div>
    13          <div v-else>
    14            <h4>{{ notification.success.sub_title }}</h4>
    15            <div v-html="notification.success.content"></div>
    16          </div>
    17        </b-alert>
    18      </b-container>
    19    </base-app>
    20  </template>
    21  
    22  <script lang="ts">
    23  import Vue from "vue";
    24  import Component from "vue-class-component";
    25  import BaseApp from "../../BaseApp.vue";
    26  
    27  import { NotificationContent } from "@/shared/logic/types";
    28  import { decodeServerPayload } from "../../shared/logic/utils";
    29  
    30  @Component({
    31    components: { BaseApp }
    32  })
    33  export default class App extends Vue {
    34    notification = decodeServerPayload<NotificationContent>();
    35  
    36    get isError() {
    37      return this.notification != null && this.notification.is_error;
    38    }
    39  
    40    get title() {
    41      if (this.notification == null) return "";
    42      if (this.isError) {
    43        return "Erreur du serveur";
    44      }
    45      return this.notification.success.title;
    46    }
    47  }
    48  </script>
    49  
    50  <style></style>