forked from BLC/sgeUpdated
Add 'sge-frontend/' from commit '5fa787e054b25ac53edc7ff0275ea7960a709401'
git-subtree-dir: sge-frontend git-subtree-mainline:876c278ac4git-subtree-split:5fa787e054
This commit is contained in:
89
sge-frontend/src/redux/actions/userProfileSettings/index.js
Normal file
89
sge-frontend/src/redux/actions/userProfileSettings/index.js
Normal file
@@ -0,0 +1,89 @@
|
||||
import ApplicationService from "../../../services/ApplicationService";
|
||||
|
||||
export const getUserProfileSettings = () => {
|
||||
return async (dispatch) => {
|
||||
ApplicationService.http()
|
||||
.post(
|
||||
"/graphql",
|
||||
{
|
||||
query: `
|
||||
mutation {
|
||||
getUserProfileSettings {
|
||||
id
|
||||
user
|
||||
infoMail
|
||||
errorMail
|
||||
infoNotification
|
||||
errorNotification
|
||||
}
|
||||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer " + localStorage.getItem("accessToken"),
|
||||
},
|
||||
}
|
||||
)
|
||||
.then((response) => {
|
||||
const getUserProfileSettings =
|
||||
response.data.data.getUserProfileSettings;
|
||||
|
||||
dispatch({
|
||||
type: "GET_USERPROFILESETTING",
|
||||
payload: {
|
||||
getUserProfileSettings,
|
||||
},
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("error -- responsee", error);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
export const updateUserProfileSettings = (data) => {
|
||||
return async (dispatch) => {
|
||||
ApplicationService.http()
|
||||
.post(
|
||||
"/graphql",
|
||||
{
|
||||
query: `
|
||||
mutation {
|
||||
updateUserProfileSettings(
|
||||
input: {
|
||||
infoMail: ${data.infoMail}
|
||||
errorMail: ${data.errorMail}
|
||||
infoNotification: ${data.infoNotification}
|
||||
errorNotification: ${data.errorNotification}
|
||||
}
|
||||
) {
|
||||
id
|
||||
user
|
||||
infoMail
|
||||
errorMail
|
||||
infoNotification
|
||||
errorNotification
|
||||
}
|
||||
}
|
||||
`,
|
||||
},
|
||||
{
|
||||
headers: {
|
||||
Authorization: "Bearer " + localStorage.getItem("accessToken"),
|
||||
},
|
||||
}
|
||||
)
|
||||
.then((response) => {
|
||||
dispatch({
|
||||
type: "UPDATE_USERPROFILESETTING",
|
||||
payload: {
|
||||
data: response.data.data.updateUserProfileSettings,
|
||||
},
|
||||
});
|
||||
})
|
||||
.catch((error) => {
|
||||
console.log("error", error);
|
||||
});
|
||||
};
|
||||
};
|
||||
Reference in New Issue
Block a user