mirror of
https://github.com/InvoiceShelf/InvoiceShelf.git
synced 2026-04-19 03:04:05 +00:00
customers, items, invoices, estimates, shared document form 77 files, 14451 lines. Typed layouts (CompanyLayout, AuthLayout, header, sidebar, company switcher), auth views (login, register, forgot/reset password), admin feature (dashboard, companies, users, settings with typed store), company features (dashboard with chart/ stats, customers CRUD, items CRUD, invoices CRUD with full store, estimates CRUD with full store), and shared document form components (items table, item row, totals, notes, tax popup, template select, exchange rate converter, calculation composable). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
45 lines
1.3 KiB
Vue
45 lines
1.3 KiB
Vue
<template>
|
|
<div
|
|
v-if="isImpersonating"
|
|
class="fixed top-0 left-0 right-0 z-50 flex items-center justify-center px-4 py-2 text-sm font-medium text-white bg-orange-600"
|
|
>
|
|
<BaseIcon name="ExclamationTriangleIcon" class="w-4 h-4 mr-2" />
|
|
<span>{{ $t('administration.users.impersonating_banner') }}</span>
|
|
<button
|
|
class="ml-4 px-3 py-1 text-xs font-semibold text-orange-600 bg-white rounded hover:bg-orange-50"
|
|
:disabled="isStopping"
|
|
@click="stopImpersonating"
|
|
>
|
|
{{ $t('administration.users.stop_impersonating') }}
|
|
</button>
|
|
</div>
|
|
</template>
|
|
|
|
<script setup lang="ts">
|
|
import { computed, ref } from 'vue'
|
|
import * as ls from '../../../utils/local-storage'
|
|
import { client } from '../../../api/client'
|
|
import { API } from '../../../api/endpoints'
|
|
|
|
const isStopping = ref<boolean>(false)
|
|
|
|
const isImpersonating = computed<boolean>(() => {
|
|
return ls.get<string>('admin.impersonating') === 'true'
|
|
})
|
|
|
|
async function stopImpersonating(): Promise<void> {
|
|
isStopping.value = true
|
|
|
|
try {
|
|
await client.post(API.SUPER_ADMIN_STOP_IMPERSONATING)
|
|
} catch {
|
|
// Token already cleaned up in store action
|
|
}
|
|
|
|
ls.remove('admin.impersonating')
|
|
ls.remove('auth.token')
|
|
|
|
window.location.href = '/admin/administration/users'
|
|
}
|
|
</script>
|