Skip to content

πŸ”§ Single source for the API base URLΒ #4516

Description

@PierreBrisorgueil

What β€” build the API base URL in one place instead of twenty-one.

Why β€” the identical ${protocol}://${host}:${port}/${base} expression is inlined 21 times across 9 files. If the URL shape ever changes, that is 21 edits and a near-certainty that one is missed.

Scope β€” export apiBase() from src/lib/services/config and adopt it everywhere. Verified counts on master:

File Occurrences
src/modules/auth/stores/auth.store.js 11
src/modules/home/stores/home.store.js 3
src/modules/admin/stores/admin.store.js 1
src/modules/billing/stores/billing.store.js 1
src/modules/invitations/stores/invitations.store.js 1
src/modules/organizations/stores/organizations.store.js 1
src/modules/tasks/stores/tasks.store.js 1
src/modules/users/stores/users.store.js 1
src/modules/docs/services/docs.service.js 1

Note this is wider than a "stores" change β€” docs.service.js is not a store, and auth.store.js alone carries half the occurrences. Six of these files also define a local apiBase() wrapper; those go too.

Sequencing: blocked by #4515 β€” both edit admin.store.js and invitations.store.js. Land #4515 first, then rebase this one.

Definition of done: grep -rn 'api.protocol}://' src (excluding tests) returns nothing, grep -rn "const apiBase = () =>" src returns nothing, and the module suites pass.

Scope: validated 2026-07-28
Created via /dev:issue


Baseline: line numbers and counts here were verified against master @ d246bc14 (2026-07-28). Master moves β€” re-verify against current master before starting; the invariants above are what must hold regardless of where the code has drifted to.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions