Skip to content

Commit 611d453

Browse files
authored
Fix/cms 80 fix the resource page (#269)
* refactor: updated editor settings for react typescript * fix: fixed the resource error
1 parent df48fa6 commit 611d453

File tree

2 files changed

+11
-8
lines changed

2 files changed

+11
-8
lines changed

.vscode/settings.json

+3
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,8 @@
88
"search.exclude": {
99
"**/build": true,
1010
"**/node_modules": true
11+
},
12+
"[typescriptreact]": {
13+
"editor.defaultFormatter": "esbenp.prettier-vscode"
1114
}
1215
}

packages/cms/pages/resources/resource/resource.tsx

+8-8
Original file line numberDiff line numberDiff line change
@@ -535,7 +535,7 @@ export const ResourceView: React.FunctionComponent = () => {
535535
const { push } = useHistory()
536536
const { resource, findResource } = useResourceStore()
537537
const { hasPermission } = useAuthStore()
538-
const { toast } = useToastStore()
538+
const [isLoading, setIsLoading] = useState(true)
539539

540540
const { resource: resourceSlug } = useParams<{
541541
resource: string
@@ -547,6 +547,8 @@ export const ResourceView: React.FunctionComponent = () => {
547547
if (!found) {
548548
push(window.Tensei.getPath(''))
549549
}
550+
551+
setIsLoading(false)
550552
}, [resourceSlug])
551553

552554
const { setSidebarState } = useSidebarStore()
@@ -559,7 +561,7 @@ export const ResourceView: React.FunctionComponent = () => {
559561
{hasPermission(`create:${resource?.slugPlural}`) ? (
560562
<Link to={window.Tensei.getPath(`resources/${resourceSlug}/create`)}>
561563
<EuiButton
562-
size={'s'}
564+
size={'m'}
563565
fill
564566
iconType={'plus'}
565567
onClick={() => {
@@ -573,13 +575,11 @@ export const ResourceView: React.FunctionComponent = () => {
573575
</DashboardLayout.Topbar>
574576
<DashboardLayout.Content>
575577
<PageWrapper>
576-
{resource ? (
577-
hasPermission(`index:${resource?.slugPlural}`) ? (
578-
<Resource resource={resource} />
579-
) : null
580-
) : (
578+
{isLoading ? (
581579
<p>Loading ...</p>
582-
)}
580+
) : hasPermission(`index:${resource?.slugPlural}`) ? (
581+
<Resource resource={resource!} />
582+
) : null}
583583
</PageWrapper>
584584
</DashboardLayout.Content>
585585
</>

0 commit comments

Comments
 (0)