show map by role
This commit is contained in:
@ -1,9 +1,60 @@
|
||||
import { restGet } from './restConsumer.js'
|
||||
import { ref, computed } from 'vue'
|
||||
import i18n from '@/i18n.js'
|
||||
|
||||
// Liste des apps
|
||||
import LoginPage from '@/Apps/Login.vue'
|
||||
import Inscription from "@/Apps/Inscription.vue"
|
||||
import Profil from "@/Apps/Profil.vue"
|
||||
import Courses from "@/Apps/ManageCourses.vue"
|
||||
|
||||
const apps = {
|
||||
'/login': LoginPage,
|
||||
'/inscription': Inscription,
|
||||
'/profil': Profil,
|
||||
'/manage-courses' : Courses,
|
||||
}
|
||||
|
||||
const appsList = {
|
||||
'Msg': { path: '#/msg', icon: 'fa-comment', text: i18n("app.messages") },
|
||||
'Notification': { path: '#/notifs', icon: 'fa-bell', text: i18n("app.notifications") },
|
||||
'Forum': { path: '#/forum', icon: 'fa-envelope', text: i18n("app.forum") },
|
||||
'Schedule': { path: '#/schedule', icon: 'fa-calendar-days', text: i18n("app.schedules") },
|
||||
'Inscription': { path: '#/inscription', icon: 'fa-users', text: i18n("app.inscription.requests") },
|
||||
'ManageCourses': { path: '#/manage-courses', icon: 'fa-book', text: i18n("app.manage.courses") },
|
||||
}
|
||||
|
||||
const currentPath = ref(window.location.hash)
|
||||
|
||||
export const currentView = computed(() => {
|
||||
return apps[currentPath.value.slice(1) || '/']
|
||||
})
|
||||
|
||||
/**
|
||||
* Return the list of app accesible by a logged (or not)
|
||||
* user.
|
||||
*/
|
||||
export async function appList(){
|
||||
return restGet("/apps")
|
||||
let ret = [];
|
||||
let userAppList = await restGet("/apps");
|
||||
for (let userapp in userAppList) {
|
||||
if(appsList[userAppList[userapp]] != null){
|
||||
ret.push(appsList[userAppList[userapp]])
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the specified page is authorized for the
|
||||
* user
|
||||
*/
|
||||
export async function checkPage(page){
|
||||
return restGet("/apps/" + page)
|
||||
return restGet("/apps/" + page)
|
||||
}
|
||||
|
||||
window.addEventListener('hashchange', () => {
|
||||
currentPath.value = window.location.hash
|
||||
})
|
||||
|
||||
// vim:set noet sts=0 sw=4 ts=2 tw=2:
|
||||
|
Reference in New Issue
Block a user