Revert "fix: [tenant-console] 테넌트 콘솔 분리작업"

This reverts commit 8da1702e
This commit is contained in:
2026-03-13 21:24:18 +09:00
parent c3bc7912dd
commit 432888980b
70 changed files with 423 additions and 1173 deletions

View File

@@ -18,6 +18,7 @@
const STORAGE_KEY = 'devToolsAuth';
const USERS_ENDPOINT = '{{ route("dev-tools.api-explorer.users") }}';
const TENANT_SWITCH_ENDPOINT = '{{ route("tenant.switch") }}';
const ISSUE_TOKEN_ENDPOINT = '{{ route("dev-tools.api-explorer.issue-token") }}';
const CSRF_TOKEN = '{{ csrf_token() }}';
@@ -371,6 +372,48 @@ function notifyChange() {
}
},
// 테넌트 변경
async switchTenant(tenantId) {
if (!tenantId) return;
try {
const formData = new FormData();
formData.append('tenant_id', tenantId);
const response = await fetch(TENANT_SWITCH_ENDPOINT, {
method: 'POST',
headers: {
'X-CSRF-TOKEN': CSRF_TOKEN,
'Accept': 'application/json'
},
body: formData
});
if (!response.ok) {
throw new Error('테넌트 변경 실패');
}
// 사용자 목록 새로고침
usersLoaded = false;
await loadUsers();
// 헤더의 테넌트 선택도 동기화
const headerTenantSelect = document.getElementById('tenant-select');
if (headerTenantSelect) {
headerTenantSelect.value = tenantId;
}
if (typeof showToast === 'function') {
showToast('회사가 변경되었습니다.', 'success');
}
} catch (err) {
console.error('테넌트 변경 실패:', err);
if (typeof showToast === 'function') {
showToast('회사 변경에 실패했습니다.', 'error');
}
}
},
// 토큰 복사
async copyToken() {
const displayToken = state.actualToken || state.token;