Browse Source

feat: 租户cookie改为store

pull/1155/head
colin 1 year ago
parent
commit
703eb4aca0
  1. 1
      apps/vben5/packages/@abp/saas/src/components/tenants/TenantSelect.vue
  2. 2
      apps/vben5/packages/@abp/saas/src/components/tenants/TenantSelectModal.vue

1
apps/vben5/packages/@abp/saas/src/components/tenants/TenantSelect.vue

@ -34,6 +34,7 @@ function onSwitchClick() {
} }
function onChange(tenant?: { id?: string; name?: string }) { function onChange(tenant?: { id?: string; name?: string }) {
abpStore.setTenantId(tenant?.id);
emits('change', tenant); emits('change', tenant);
} }
</script> </script>

2
apps/vben5/packages/@abp/saas/src/components/tenants/TenantSelectModal.vue

@ -53,7 +53,6 @@ async function onSubmit(values: Record<string, any>) {
modalApi.setState({ submitting: true }); modalApi.setState({ submitting: true });
try { try {
tenant.value = undefined; tenant.value = undefined;
localStorage.removeItem('__tenant');
if (values.name) { if (values.name) {
const result = await findTenantByNameApi(values.name); const result = await findTenantByNameApi(values.name);
if (!result.success) { if (!result.success) {
@ -69,7 +68,6 @@ async function onSubmit(values: Record<string, any>) {
return; return;
} }
tenant.value = { id: result.tenantId, name: result.normalizedName }; tenant.value = { id: result.tenantId, name: result.normalizedName };
localStorage.setItem('__tenant', result.tenantId!);
} }
emits('change', tenant.value); emits('change', tenant.value);
modalApi.close(); modalApi.close();

Loading…
Cancel
Save