Skip to content

Commit

Permalink
Add endpoint for listing all windows (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
JCombee authored Nov 2, 2024
1 parent e9d3c4b commit f20d0c1
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
3 changes: 3 additions & 0 deletions resources/js/electron-plugin/dist/server/api/window.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,9 @@ router.get('/current', (req, res) => {
const id = Object.keys(state.windows).find(key => state.windows[key] === currentWindow);
res.json(getWindowData(id));
});
router.get('/all', (req, res) => {
res.json(Object.keys(state.windows).map(id => getWindowData(id)));
});
router.get('/get/:id', (req, res) => {
const { id } = req.params;
if (state.windows[id] === undefined) {
Expand Down
6 changes: 6 additions & 0 deletions resources/js/electron-plugin/src/server/api/window.ts
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,12 @@ router.get('/current', (req, res) => {
res.json(getWindowData(id));
});

router.get('/all', (req, res) => {
res.json(
Object.keys(state.windows).map(id => getWindowData(id))
);
});

router.get('/get/:id', (req, res) => {
const {id} = req.params;

Expand Down

0 comments on commit f20d0c1

Please sign in to comment.