import axios from 'axios';
const notificationRequests = {
getSettings: async () => {
console.log("hello")
return await axios.get(`/api/notifications-morph/settings`);
},
setSettings: async data => {
return await axios.post(`/api/notifications-morph/settings`, data);
},
};
export default notificationRequests;```
``` // server/routes/index.js
...
{
method: 'GET',
path: '/notifications-plugin/settings',
handler: 'settings.get',
config: {
policies: [],
},
},
{
method: 'POST',
path: '/notifications-plugin/settings',
handler: 'settings.update',
config: {
policies: [],
},
},```
```// server/controllers/settings.js
module.exports = {
async get(ctx) {{
const settings = await strapi.plugins['notifications-morph'].services.settings.find();
ctx.send({ settings });
}},
async update(ctx) {{
const settings = await strapi.plugins['notifications-morph'].services.settings.update(ctx.request.body);
ctx.send({ settings });
}},
};```