diff --git a/frontend/src/app/dashboard/backoffice/page.tsx b/frontend/src/app/dashboard/backoffice/page.tsx
index 9bf30a1..1167808 100644
--- a/frontend/src/app/dashboard/backoffice/page.tsx
+++ b/frontend/src/app/dashboard/backoffice/page.tsx
@@ -68,9 +68,9 @@ export default function BackofficePage() {
loadBackoffice()
}, [router])
- const loadBackoffice = async () => {
+ const loadBackoffice = async (silent = false) => {
try {
- setLoading(true)
+ if (!silent) setLoading(true)
const [rolesData, auditData, companiesData, jobsData, tagsData] = await Promise.all([
adminAccessApi.listRoles(),
adminAuditApi.listLogins(20),
@@ -87,7 +87,7 @@ export default function BackofficePage() {
console.error("Error loading backoffice:", error)
toast.error("Failed to load backoffice data")
} finally {
- setLoading(false)
+ if (!silent) setLoading(false)
}
}
@@ -95,7 +95,7 @@ export default function BackofficePage() {
try {
await adminCompaniesApi.updateStatus(companyId, { verified: true })
toast.success("Company approved")
- loadBackoffice()
+ loadBackoffice(true)
} catch (error) {
console.error("Error approving company:", error)
toast.error("Failed to approve company")
@@ -106,7 +106,7 @@ export default function BackofficePage() {
try {
await adminCompaniesApi.updateStatus(companyId, { active: false })
toast.success("Company deactivated")
- loadBackoffice()
+ loadBackoffice(true)
} catch (error) {
console.error("Error deactivating company:", error)
toast.error("Failed to deactivate company")
@@ -117,7 +117,7 @@ export default function BackofficePage() {
try {
await adminJobsApi.updateStatus(jobId, status)
toast.success("Job status updated")
- loadBackoffice()
+ loadBackoffice(true)
} catch (error) {
console.error("Error updating job status:", error)
toast.error("Failed to update job status")
@@ -128,7 +128,7 @@ export default function BackofficePage() {
try {
await adminJobsApi.duplicate(jobId)
toast.success("Job duplicated as draft")
- loadBackoffice()
+ loadBackoffice(true)
} catch (error) {
console.error("Error duplicating job:", error)
toast.error("Failed to duplicate job")
@@ -145,7 +145,7 @@ export default function BackofficePage() {
await adminTagsApi.create({ name: tagForm.name.trim(), category: tagForm.category })
toast.success("Tag created")
setTagForm({ name: "", category: "area" })
- loadBackoffice()
+ loadBackoffice(true)
} catch (error) {
console.error("Error creating tag:", error)
toast.error("Failed to create tag")
@@ -158,7 +158,7 @@ export default function BackofficePage() {
try {
await adminTagsApi.update(tag.id, { active: !tag.active })
toast.success("Tag updated")
- loadBackoffice()
+ loadBackoffice(true)
} catch (error) {
console.error("Error updating tag:", error)
toast.error("Failed to update tag")
@@ -180,7 +180,7 @@ export default function BackofficePage() {
Backoffice
Controle administrativo do GoHorse Jobs
-