Skip to content

Commit 2d7b53f

Browse files
talissoncostaclaude
andcommitted
refactor: standardize organisation ID types to number
- Change organisation ID types from 'string | number' to 'number' - Aligns with RouteContext which provides organisationId as number - Matches API response format where IDs are returned as numbers - JavaScript automatically converts numbers to strings in URL template literals - Improves type safety and eliminates confusion 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent e06b032 commit 2d7b53f

File tree

3 files changed

+8
-11
lines changed

3 files changed

+8
-11
lines changed

frontend/common/types/requests.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -158,9 +158,9 @@ export type Req = {
158158
environments?: string
159159
}>
160160
getOrganisations: {}
161-
getOrganisation: { id: string | number }
162-
updateOrganisation: { id: string | number; body: UpdateOrganisationBody }
163-
deleteOrganisation: { id: string | number }
161+
getOrganisation: { id: number }
162+
updateOrganisation: { id: number; body: UpdateOrganisationBody }
163+
deleteOrganisation: { id: number }
164164
uploadOrganisationLicence: {
165165
id: number
166166
body: {

frontend/web/components/pages/organisation-settings/hooks/useDeleteOrganisationWithToast.ts

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,18 +17,15 @@ export const useDeleteOrganisationWithToast = () => {
1717
const { data: organisations } = useGetOrganisationsQuery({})
1818

1919
const deleteWithToast = useCallback(
20-
async (
21-
organisationId: string | number,
22-
options?: DeleteOrganisationOptions,
23-
) => {
20+
async (organisationId: number, options?: DeleteOrganisationOptions) => {
2421
try {
2522
await deleteOrganisation({
26-
id: String(organisationId),
23+
id: organisationId,
2724
}).unwrap()
2825

2926
// Calculate next available organisation after deletion
3027
const remaining = organisations?.results?.filter(
31-
(org) => org.id !== Number(organisationId),
28+
(org) => org.id !== organisationId,
3229
)
3330
const nextOrgId = remaining?.[0]?.id
3431

frontend/web/components/pages/organisation-settings/hooks/useUpdateOrganisationWithToast.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ export const useUpdateOrganisationWithToast = () => {
1414
const updateWithToast = useCallback(
1515
async (
1616
body: UpdateOrganisationBody,
17-
organisationId: string | number,
17+
organisationId: number,
1818
options?: UpdateOrganisationOptions,
1919
) => {
2020
try {
2121
await updateOrganisation({
2222
body,
23-
id: String(organisationId),
23+
id: organisationId,
2424
}).unwrap()
2525
toast(options?.successMessage || 'Saved organisation')
2626
// Refresh AccountStore to update navbar and other components

0 commit comments

Comments
 (0)