Loading capif_frontend/src/configs/acl.js +2 −2 Changes for capif_frontend/src/configs/acl.js: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -11,9 +11,9 @@ const defineRulesFor = (role, subject) => { const { can, cannot, rules } = new AbilityBuilder(AppAbility) if (role === 'admin') { can('manage', 'all') cannot('read', 'user-home') cannot('read', 'user-area') } else if (role === 'user') { can('read', 'user-home') can('read', 'user-area') } else if (role === 'client') { can(['read'], 'acl-page') } Loading capif_frontend/src/configs/apiService.js +26 −0 Changes for capif_frontend/src/configs/apiService.js: 26 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -589,3 +589,29 @@ export const removeRegisterConfigCategory = async ({ category_name }) => { } }; // ME (user-scoped) // Unlike the functions above, these do not wrap errors in `new Error(...)`: the axios error // is rethrown unchanged so callers keep `error.response.status`. Here the status codes carry // meaning (403 no CAPIF credentials, 404 not your invoker, 502 CCF failed) and the UI renders // a different state for each. Don't "harmonise" these with the rest of the file. export const onboardInvoker = async ({ apiInvokerInformation, notificationDestination }) => { const response = await axiosInstance.post('/me/invoker', { apiInvokerInformation, notificationDestination }) return response.data } export const getMyInvokers = async () => { const response = await axiosInstance.get('/me/invokers') return response.data } export const discoverApis = async invokerId => { const response = await axiosInstance.get(`/me/invokers/${encodeURIComponent(invokerId)}/apis`) return response.data } capif_frontend/src/configs/queryHelpers.js 0 → 100644 +15 −0 Changes for capif_frontend/src/configs/queryHelpers.js: 15 added lines, 0 removed lines. Original line number Diff line number Diff line // Client errors (e.g. 403, 404) won't change on retry; only retry server-side failures. export const retryServerErrorsOnly = (failureCount, error) => { const status = error?.response?.status if (status && status < 500) return false return failureCount < 3 } // Backend messages are deliberately generic, so show them with a fallback. // With no response at all (backend unreachable), the fallback is shown. export const errorMessage = (error, fallback) => { if (error?.response?.status === 403) return 'This account has no CAPIF credentials.' return error?.response?.data?.error || fallback } No newline at end of file capif_frontend/src/navigation/vertical/index.js +8 −1 Changes for capif_frontend/src/navigation/vertical/index.js: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -5,7 +5,14 @@ const navigation = () => { icon: 'mdi:home-outline', path: '/home', action: 'read', subject: 'user-home' subject: 'user-area' }, { title: 'Invokers', icon: 'mdi:baseline-people', path: '/me/invokers', action: 'read', subject: 'user-area' }, { title: 'Dashboard', Loading capif_frontend/src/pages/home/index.js +1 −1 Changes for capif_frontend/src/pages/home/index.js: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ const Home = () => { Home.acl = { action: 'read', subject: 'user-home' subject: 'user-area' } export default Home No newline at end of file Loading
capif_frontend/src/configs/acl.js +2 −2 Changes for capif_frontend/src/configs/acl.js: 2 added lines, 2 removed lines. Original line number Diff line number Diff line Loading @@ -11,9 +11,9 @@ const defineRulesFor = (role, subject) => { const { can, cannot, rules } = new AbilityBuilder(AppAbility) if (role === 'admin') { can('manage', 'all') cannot('read', 'user-home') cannot('read', 'user-area') } else if (role === 'user') { can('read', 'user-home') can('read', 'user-area') } else if (role === 'client') { can(['read'], 'acl-page') } Loading
capif_frontend/src/configs/apiService.js +26 −0 Changes for capif_frontend/src/configs/apiService.js: 26 added lines, 0 removed lines. Original line number Diff line number Diff line Loading @@ -589,3 +589,29 @@ export const removeRegisterConfigCategory = async ({ category_name }) => { } }; // ME (user-scoped) // Unlike the functions above, these do not wrap errors in `new Error(...)`: the axios error // is rethrown unchanged so callers keep `error.response.status`. Here the status codes carry // meaning (403 no CAPIF credentials, 404 not your invoker, 502 CCF failed) and the UI renders // a different state for each. Don't "harmonise" these with the rest of the file. export const onboardInvoker = async ({ apiInvokerInformation, notificationDestination }) => { const response = await axiosInstance.post('/me/invoker', { apiInvokerInformation, notificationDestination }) return response.data } export const getMyInvokers = async () => { const response = await axiosInstance.get('/me/invokers') return response.data } export const discoverApis = async invokerId => { const response = await axiosInstance.get(`/me/invokers/${encodeURIComponent(invokerId)}/apis`) return response.data }
capif_frontend/src/configs/queryHelpers.js 0 → 100644 +15 −0 Changes for capif_frontend/src/configs/queryHelpers.js: 15 added lines, 0 removed lines. Original line number Diff line number Diff line // Client errors (e.g. 403, 404) won't change on retry; only retry server-side failures. export const retryServerErrorsOnly = (failureCount, error) => { const status = error?.response?.status if (status && status < 500) return false return failureCount < 3 } // Backend messages are deliberately generic, so show them with a fallback. // With no response at all (backend unreachable), the fallback is shown. export const errorMessage = (error, fallback) => { if (error?.response?.status === 403) return 'This account has no CAPIF credentials.' return error?.response?.data?.error || fallback } No newline at end of file
capif_frontend/src/navigation/vertical/index.js +8 −1 Changes for capif_frontend/src/navigation/vertical/index.js: 8 added lines, 1 removed line. Original line number Diff line number Diff line Loading @@ -5,7 +5,14 @@ const navigation = () => { icon: 'mdi:home-outline', path: '/home', action: 'read', subject: 'user-home' subject: 'user-area' }, { title: 'Invokers', icon: 'mdi:baseline-people', path: '/me/invokers', action: 'read', subject: 'user-area' }, { title: 'Dashboard', Loading
capif_frontend/src/pages/home/index.js +1 −1 Changes for capif_frontend/src/pages/home/index.js: 1 added line, 1 removed line. Original line number Diff line number Diff line Loading @@ -12,7 +12,7 @@ const Home = () => { Home.acl = { action: 'read', subject: 'user-home' subject: 'user-area' } export default Home No newline at end of file