ドキュメント
アプリを開く

Admin page

Admin page は同じ native page primitive を workspace administration に配置したものです。App 設定と運用 control に使い、通常 member の workflow には使いません。

YAML
contributes:
  ui:
    - id: reports-admin
      kind: nativeModule
      surface: page
      slot: admin.workspace.tab
      sectionId: reports
      label: Reports settings
      route: /admin/reports/*
      roles: [OWNER, ADMIN]
      module:
        entry: dist/ui/app.js
        export: ReportsAdmin
        styles: dist/ui/app.css

roles を宣言し、backend でも authorization を必ず検証します。UI の非表示は security boundary ではありません。

TSX
import { useAppFetch } from '@sota/platform';

export function ReportsAdmin() {
  const appFetch = useAppFetch();
  async function save() {
    const response = await appFetch('/settings', {
      method: 'PUT',
      headers: { 'content-type': 'application/json' },
      body: JSON.stringify({ enabled: true }),
    });
    if (!response.ok) throw new Error('Could not save settings');
  }
  return <button type="button" onClick={save}>Enable reports</button>;
}

目次

Esc

全章のタイトルと本文を検索します。