Internal - Fix js errors

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

@ -130,11 +130,19 @@ export default {
},
created() {
this.$data.legacy_content = '';
// section-content
let isAuthenticated = JSON.parse(this.$parent.$el.attributes["data-is-authenticated"].value),
user = JSON.parse(this.$parent.$el.attributes["data-user-json"].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);
}
let payload = {isAuthenticated: isAuthenticated, user: user};
this.$store.dispatch("security/onRefresh", payload);
if (this.$parent.$el.attributes["data-flashes"]) {
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, {
type: type,
position: 'top-center',

@ -2,7 +2,7 @@
<div class="course-list">
{{ status }}
<CourseCardList
:courses="courses"
:courses="courses"
/>
</div>
</template>
@ -10,7 +10,7 @@
<script>
import CourseCardList from './CourseCardList';
import ListMixin from '../../../mixins/ListMixin';
import { ENTRYPOINT } from '../../../config/entrypoint';
import {ENTRYPOINT} from '../../../config/entrypoint';
import axios from "axios";
export default {
@ -30,13 +30,13 @@ export default {
this.load();
},
methods: {
load: function() {
load: function () {
this.status = 'Loading';
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.courses = response.data;
}).catch(function(error) {
}).catch(function (error) {
console.log(error);
});
}

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

Loading…
Cancel
Save