feat: add business line permissions and Wayne namespace mapping
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import type { ApiResponse } from '@/types/api'
|
||||
import { getToken, removeToken } from '@/utils/auth'
|
||||
import { redirectToSSO } from '@/utils/sso'
|
||||
import { useBusinessLineStore } from '@/stores/businessLine'
|
||||
|
||||
export interface Subsystem {
|
||||
id: number
|
||||
@@ -126,7 +127,7 @@ export const subsystemApi = {
|
||||
|
||||
const token = getToken()
|
||||
const openApp = subsystem.name === 'CloudDM' ? 'clouddm' : 'wayne'
|
||||
const path = subsystem.name === 'CloudDM' ? '/auth/api/v1/clouddm/login' : '/auth/api/v1/wayen/login'
|
||||
const path = subsystem.name === 'CloudDM' ? '/auth/api/v1/clouddm/login' : wayneLoginPath()
|
||||
const response = await fetch(path, {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
@@ -164,3 +165,11 @@ export const subsystemApi = {
|
||||
}
|
||||
},
|
||||
}
|
||||
|
||||
function wayneLoginPath(): string {
|
||||
const businessLineID = useBusinessLineStore().current?.id
|
||||
if (!businessLineID) {
|
||||
return '/auth/api/v1/wayen/login'
|
||||
}
|
||||
return `/auth/api/v1/wayen/login?business_line_id=${encodeURIComponent(String(businessLineID))}`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user