Internal - Fix js errors

pull/3464/head
Julio Montoya 5 years ago
parent 81d51deda0
commit 9111eb0d9e
  1. 12
      assets/vue/App.vue
  2. 4
      assets/vue/mixins/NotificationMixin.js
  3. 8
      assets/vue/views/user/courses/List.vue
  4. 8
      public/main/inc/lib/display.lib.php

@ -130,11 +130,19 @@ export default {
}, },
created() { created() {
this.$data.legacy_content = ''; this.$data.legacy_content = '';
// section-content
let isAuthenticated = JSON.parse(this.$parent.$el.attributes["data-is-authenticated"].value), let isAuthenticated = false;
if (this.$parent.$el.attributes["data-is-authenticated"].value) {
isAuthenticated = JSON.parse(this.$parent.$el.attributes["data-is-authenticated"].value);
}
let user = null;
if (this.$parent.$el.attributes["data-user-json"].value) {
user = JSON.parse(this.$parent.$el.attributes["data-user-json"].value); user = JSON.parse(this.$parent.$el.attributes["data-user-json"].value);
}
let payload = {isAuthenticated: isAuthenticated, user: user}; let payload = {isAuthenticated: isAuthenticated, user: user};
this.$store.dispatch("security/onRefresh", payload); this.$store.dispatch("security/onRefresh", payload);
if (this.$parent.$el.attributes["data-flashes"]) { if (this.$parent.$el.attributes["data-flashes"]) {
let flashes = JSON.parse(this.$parent.$el.attributes["data-flashes"].value); let flashes = JSON.parse(this.$parent.$el.attributes["data-flashes"].value);

@ -32,6 +32,10 @@ export default {
} }
}; };
if ('danger' === type) {
type = 'error';
}
this.$toast(content, { this.$toast(content, {
type: type, type: type,
position: 'top-center', position: 'top-center',

@ -10,7 +10,7 @@
<script> <script>
import CourseCardList from './CourseCardList'; import CourseCardList from './CourseCardList';
import ListMixin from '../../../mixins/ListMixin'; import ListMixin from '../../../mixins/ListMixin';
import { ENTRYPOINT } from '../../../config/entrypoint'; import {ENTRYPOINT} from '../../../config/entrypoint';
import axios from "axios"; import axios from "axios";
export default { export default {
@ -30,13 +30,13 @@ export default {
this.load(); this.load();
}, },
methods: { methods: {
load: function() { load: function () {
this.status = 'Loading'; this.status = 'Loading';
let user = this.$store.getters['security/getUser']; let user = this.$store.getters['security/getUser'];
axios.get(ENTRYPOINT + 'users/'+ user.id +'/courses.json').then(response => { axios.get(ENTRYPOINT + 'users/' + user.id + '/courses.json').then(response => {
this.status = ''; this.status = '';
this.courses = response.data; this.courses = response.data;
}).catch(function(error) { }).catch(function (error) {
console.log(error); console.log(error);
}); });
} }

@ -469,11 +469,8 @@ class Display
* *
* @return string Message wrapped into an HTML div * @return string Message wrapped into an HTML div
*/ */
public static function return_message( public static function return_message($message, $type = 'normal', $filter = true)
$message, {
$type = 'normal',
$filter = true
) {
if (empty($message)) { if (empty($message)) {
return ''; return '';
} }
@ -500,6 +497,7 @@ class Display
$class .= 'alert alert-success'; $class .= 'alert alert-success';
break; break;
case 'normal': case 'normal':
case 'info':
default: default:
$class .= 'alert alert-info'; $class .= 'alert alert-info';
} }

Loading…
Cancel
Save