This commit is contained in:
@@ -8,13 +8,52 @@ type TargetRoute = {
|
||||
}
|
||||
|
||||
const resolveTargetRoute = (target: NotificationTarget): TargetRoute | null => {
|
||||
const targetValues = [target.target_key, target.target_type]
|
||||
const targetId = target.target_id === null ? undefined : String(target.target_id)
|
||||
const targetKey = target.target_key || ''
|
||||
|
||||
if (targetValues.includes('expiring_assets') || targetValues.includes('expiring_asset_list')) {
|
||||
if (target.target_type === 'refund_detail' && targetId) {
|
||||
return { path: `${RoutesAlias.RefundDetail}/${targetId}` }
|
||||
}
|
||||
|
||||
if (target.target_type === 'agent_recharge_detail' && targetId) {
|
||||
return { path: `${RoutesAlias.AgentRechargeDetail}/${targetId}` }
|
||||
}
|
||||
|
||||
if (target.target_type === 'iot_card_detail' && (targetKey || targetId)) {
|
||||
return {
|
||||
path: RoutesAlias.AssetInformation,
|
||||
query: { iccid: targetKey || targetId || '' }
|
||||
}
|
||||
}
|
||||
|
||||
if (target.target_type === 'device_detail' && (targetKey || targetId)) {
|
||||
return {
|
||||
path: RoutesAlias.AssetInformation,
|
||||
query: { virtual_no: targetKey || targetId || '' }
|
||||
}
|
||||
}
|
||||
|
||||
if (
|
||||
target.target_type === 'expiring_asset_list' ||
|
||||
target.target_key === 'expiring_assets' ||
|
||||
target.target_key === 'expiring_asset_list'
|
||||
) {
|
||||
return { path: RoutesAlias.ExpiringAssets }
|
||||
}
|
||||
|
||||
if (targetValues.includes('notification_center')) return { path: RoutesAlias.Notifications }
|
||||
if (target.target_type === 'shop_fund_summary') {
|
||||
return {
|
||||
path: RoutesAlias.AgentFundOverview,
|
||||
query: targetId ? { shop_id: targetId } : undefined
|
||||
}
|
||||
}
|
||||
|
||||
if (target.target_type === 'system_config') {
|
||||
return {
|
||||
path: RoutesAlias.SystemConfigs,
|
||||
query: targetKey ? { config_key: targetKey } : undefined
|
||||
}
|
||||
}
|
||||
|
||||
return null
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user