Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Platform
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Platform
Commits
1e772cca
Unverified
Commit
1e772cca
authored
Oct 03, 2017
by
Nicolas Widart
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Define function before usage
parent
91d1b699
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
53 additions
and
54 deletions
+53
-54
app.js
public/js/app.js
+41
-41
app.js
resources/assets/js/app.js
+12
-13
No files found.
public/js/app.js
View file @
1e772cca
...
...
@@ -42742,6 +42742,7 @@ _vue2.default.use(_vueDataTables2.default, { locale: _en2.default });
_vue2.default.use(_vueI18n2.default);
_vue2.default.use(_vueRouter2.default);
_vue2.default.use(__webpack_require__(170), { prevent: ['input', 'textarea'] });
_vue2.default.use(_vueEvents2.default);
_vue2.default.use(_vueSimplemde2.default);
__webpack_require__(171);
...
...
@@ -42752,56 +42753,55 @@ _vue2.default.component('TagsInput', __webpack_require__(181));
_vue2.default.component('SingleMedia', __webpack_require__(184));
_vue2.default.component('MediaManager', __webpack_require__(43));
var currentLocale = window.AsgardCMS.currentLocale;
var adminPrefix = window.AsgardCMS.adminPrefix;
var router = new _vueRouter2.default({
mode: 'history',
base: makeBaseUrl(),
routes: [].concat(_toConsumableArray(_PageRoutes2.default), _toConsumableArray(_MediaRoutes2.default))
});
function makeBaseUrl() {
if (window.AsgardCMS.hideDefaultLocaleInURL == 1) {
return adminPrefix;
}
return currentLocale + '/' + adminPrefix;
if (window.AsgardCMS.hideDefaultLocaleInURL == 1) {
return adminPrefix;
}
return currentLocale + '/' + adminPrefix;
}
var router = new _vueRouter2.default({
mode: 'history',
base: makeBaseUrl(),
routes: [].concat(_toConsumableArray(_PageRoutes2.default), _toConsumableArray(_MediaRoutes2.default))
});
var messages = _defineProperty({}, currentLocale, window.AsgardCMS.translations);
var i18n = new _vueI18n2.default({
locale: currentLocale,
messages: messages
locale: currentLocale,
messages: messages
});
var app = new _vue2.default({
el: '#app',
router: router,
i18n: i18n
el: '#app',
router: router,
i18n: i18n
});
window.axios.interceptors.response.use(null, function (error) {
if (error.response === undefined) {
console.log(error);
return;
}
if (error.response.status === 403) {
app.$notify.error({
title: app.$t('core.unauthorized'),
message: app.$t('core.unauthorized-access')
});
window.location = route('dashboard.index');
}
if (error.response.status === 401) {
app.$notify.error({
title: app.$t('core.unauthenticated'),
message: app.$t('core.unauthenticated-message')
});
window.location = route('login');
}
return Promise.reject(error);
if (error.response === undefined) {
console.log(error);
return;
}
if (error.response.status === 403) {
app.$notify.error({
title: app.$t('core.unauthorized'),
message: app.$t('core.unauthorized-access')
});
window.location = route('dashboard.index');
}
if (error.response.status === 401) {
app.$notify.error({
title: app.$t('core.unauthenticated'),
message: app.$t('core.unauthenticated-message')
});
window.location = route('login');
}
return Promise.reject(error);
});
/***/ }),
...
...
@@ -96157,25 +96157,25 @@ window.axios.defaults.headers.common['X-Requested-With'] = 'XMLHttpRequest';
var token = document.head.querySelector('meta[name="csrf-token"]');
if (token) {
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
window.axios.defaults.headers.common['X-CSRF-TOKEN'] = token.content;
} else {
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
console.error('CSRF token not found: https://laravel.com/docs/csrf#csrf-x-csrf-token');
}
var userApiToken = document.head.querySelector('meta[name="user-api-token"]');
if (userApiToken) {
window.axios.defaults.headers.common['Authorization']
= 'Bearer ' + userApiToken.content;
window.axios.defaults.headers.common.Authorization
= 'Bearer ' + userApiToken.content;
} else {
console.error('User API token not found in a meta tag.');
console.error('User API token not found in a meta tag.');
}
var currentLocale = document.head.querySelector('meta[name="current-locale"]');
if (currentLocale) {
window.AsgardCMS.currentLocale = currentLocale.content;
window.AsgardCMS.currentLocale = currentLocale.content;
} else {
console.error('Current locale token not found in a meta tag.');
console.error('Current locale token not found in a meta tag.');
}
/**
resources/assets/js/app.js
View file @
1e772cca
...
...
@@ -8,12 +8,14 @@ import DataTables from 'vue-data-tables';
import
VueEvents
from
'
vue-events
'
;
import
locale
from
'
element-ui/lib/locale/lang/en
'
;
import
VueSimplemde
from
'
vue-simplemde
'
;
import
PageRoutes
from
'
../../../Modules/Page/Assets/js/PageRoutes
'
;
import
MediaRoutes
from
'
../../../Modules/Media/Assets/js/MediaRoutes
'
;
Vue
.
use
(
ElementUI
,
{
locale
});
Vue
.
use
(
DataTables
,
{
locale
});
Vue
.
use
(
ElementUI
,
{
locale
});
Vue
.
use
(
DataTables
,
{
locale
});
Vue
.
use
(
VueI18n
);
Vue
.
use
(
VueRouter
);
Vue
.
use
(
require
(
'
vue-shortkey
'
),
{
prevent
:
[
'
input
'
,
'
textarea
'
]
});
Vue
.
use
(
require
(
'
vue-shortkey
'
),
{
prevent
:
[
'
input
'
,
'
textarea
'
]
});
Vue
.
use
(
VueEvents
);
Vue
.
use
(
VueSimplemde
);
...
...
@@ -26,13 +28,17 @@ Vue.component('TagsInput', require('../../../Modules/Tag/Assets/js/components/Ta
Vue
.
component
(
'
SingleMedia
'
,
require
(
'
../../../Modules/Media/Assets/js/components/SingleMedia.vue
'
));
Vue
.
component
(
'
MediaManager
'
,
require
(
'
../../../Modules/Media/Assets/js/components/MediaManager.vue
'
));
import
PageRoutes
from
'
../../../Modules/Page/Assets/js/PageRoutes
'
;
import
MediaRoutes
from
'
../../../Modules/Media/Assets/js/MediaRoutes
'
;
const
currentLocale
=
window
.
AsgardCMS
.
currentLocale
;
const
adminPrefix
=
window
.
AsgardCMS
.
adminPrefix
;
function
makeBaseUrl
()
{
if
(
window
.
AsgardCMS
.
hideDefaultLocaleInURL
==
1
)
{
return
adminPrefix
;
}
return
`
${
currentLocale
}
/
${
adminPrefix
}
`
;
}
const
router
=
new
VueRouter
({
mode
:
'
history
'
,
base
:
makeBaseUrl
(),
...
...
@@ -42,13 +48,6 @@ const router = new VueRouter({
],
});
function
makeBaseUrl
()
{
if
(
window
.
AsgardCMS
.
hideDefaultLocaleInURL
==
1
)
{
return
adminPrefix
;
}
return
`
${
currentLocale
}
/
${
adminPrefix
}
`
;
}
const
messages
=
{
[
currentLocale
]:
window
.
AsgardCMS
.
translations
,
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment