You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

26 lines
592 B

import Vue from 'vue'
declare module 'vue/types/vue' {
interface Vue {
$translateRole(role: string, mappings: object): string
}
}
type RoleMapping = {
projectAdmin: string
annotator: string
annotationApprover: string
undefined: string
}
Vue.prototype.$translateRole = (role: string, mapping: RoleMapping) => {
if (role === 'project_admin') {
return mapping.projectAdmin
} else if (role === 'annotator') {
return mapping.annotator
} else if (role === 'annotation_approver') {
return mapping.annotationApprover
} else {
return mapping.undefined
}
}