Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F53863577
index.js
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
index.js
View Options
import
{
createRouter
,
createWebHistory
}
from
'vue-router'
import
StatusPage
from
'@/views/StatusPage.vue'
import
{
authApi
}
from
'@/plugins/api'
const
router
=
createRouter
({
history
:
createWebHistory
(
import
.
meta
.
env
.
BASE_URL
),
routes
:
[
{
path
:
'/'
,
name
:
'status'
,
component
:
StatusPage
,
},
{
path
:
'/confirm/:token'
,
name
:
'confirm-subscription'
,
component
:
()
=>
import
(
'@/views/ConfirmSubscription.vue'
),
},
{
path
:
'/unsubscribe/:token'
,
name
:
'unsubscribe'
,
component
:
()
=>
import
(
'@/views/Unsubscribe.vue'
),
},
{
path
:
'/admin/login'
,
name
:
'admin-login'
,
component
:
()
=>
import
(
'@/views/AdminLogin.vue'
),
},
{
path
:
'/admin'
,
name
:
'admin'
,
component
:
()
=>
import
(
'@/views/AdminDashboard.vue'
),
meta
:
{
requiresAuth
:
true
},
},
{
path
:
'/:pathMatch(.*)*'
,
name
:
'not-found'
,
component
:
()
=>
import
(
'@/views/NotFound.vue'
),
},
],
})
router
.
beforeEach
(
async
(
to
)
=>
{
if
(
to
.
meta
.
requiresAuth
)
{
const
token
=
localStorage
.
getItem
(
'servpulse_token'
)
if
(
!
token
)
{
return
{
name
:
'admin-login'
}
}
try
{
await
authApi
.
verify
(
token
)
}
catch
{
localStorage
.
removeItem
(
'servpulse_token'
)
return
{
name
:
'admin-login'
}
}
}
})
export
default
router
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Wed, Oct 14, 20:37 (22 h, 38 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
4185773
Default Alt Text
index.js (1 KB)
Attached To
Mode
rSP ServPulse
Attached
Detach File
Event Timeline
Log In to Comment