I want to create an app that shows the current version of the page it is on. I adjusted the hello world tutorial to call the /wiki/api/v2/pages/{id}/versions REST url and changed the scope to read:page:confluence. I did the forge lint --fix, forge deploy and forge install --upgrade commands, but it keeps complaining that the scope is invalid.
What am I missing?
code:
import ForgeUI, { render, Fragment, Macro, Text, useProductContext, useState } from "@forge/ui";
import api, { route } from "@forge/api";
const getLatestVersionForContent = async (contentId) => {
const res = await api
.asUser()
.requestConfluence(route`/wiki/api/v2/pages/${contentId}/versions?body-format=storage`);
console.log(`Response: ${res.status} ${res.statusText}`);
const data = await res.json();
return data.results;
}
const App = () => {
const context = useProductContext();
console.log(`ContentIds: ${context.contentId}`);
const [versions] = useState(async () => await getLatestVersionForContent(context.contentId));
return (
<Fragment>
<Text>Hello world with revisions!</Text>
</Fragment>
);
};
export const run = render(
<Macro
app={<App />}
/>
);
and
manifest scopes:
permissions:
scopes:
- read:page:confluence
- read:confluence-props