Skip to content

Commit

Permalink
fix api routes
Browse files Browse the repository at this point in the history
  • Loading branch information
AlbertLnz committed Oct 11, 2023
1 parent d19058d commit d9125ef
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ export const getCollaboratorsData = createAsyncThunk(
'getinitialdataCollaborators',
async () => {
try {
const { data } = await axios.get('http://87.106.229.119//api/collaborators/landing');
const { data } = await axios.get('http://87.106.229.119/api/collaborators/landing');

const dataTotal = data.sort(() => Math.random() - 0.5);
return dataTotal;
Expand Down
4 changes: 2 additions & 2 deletions src/store/reducers/apiCall/apiPostRegisterLogin.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ export const handleSubmit = async (
//RESGISTER
if (number === 1) {
axios
.post("http://87.106.229.119//api/register", formData)
.post("http://87.106.229.119/api/register", formData)
.then((resp) => {
console.log(resp);
dispatch(
Expand All @@ -94,7 +94,7 @@ export const handleSubmit = async (
//LOGIN
} else if (number === 2) {
axios
.post("http://87.106.229.119//api/login", formData)
.post("http://87.106.229.119/api/login", formData)
.then((resp) => {
dispatch(setToken(resp.data.result.access_token));
dispatch(setIsLogged(true));
Expand Down
4 changes: 2 additions & 2 deletions src/store/reducers/apiCall/apiResetPassword.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const {sendEmailSuccess, sendEmailFailure} = apiSliceResetPassword.action


export const handleSubmit = (dispatch: Dispatch , email: string) => {
axios.post('http://87.106.229.119//api/forget-password', {email})
axios.post('http://87.106.229.119/api/forget-password', {email})
.then(() => {
dispatch(sendEmailSuccess(email))
})
Expand All @@ -36,7 +36,7 @@ export const handleSubmit = (dispatch: Dispatch , email: string) => {
export const handleReset = (dispatch: Dispatch , e: FormDataEvent, newPassword:string , newConfirmationPassword:string , resetToken:string) => {
e.preventDefault()
try{
axios.post(`http://87.106.229.119//api/reset-password/${resetToken}`, {password: newPassword, password_confirmation: newConfirmationPassword})
axios.post(`http://87.106.229.119/api/reset-password/${resetToken}`, {password: newPassword, password_confirmation: newConfirmationPassword})
.then(() => {
dispatch(sendEmailFailure())
})
Expand Down
14 changes: 7 additions & 7 deletions src/store/reducers/appsCall/appsCallApiFunctionality.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ export const { setApps, setAppsInfo, setLoadingApps } = apiSlice.actions;
//llamada api a apps//
export const apiCallApps = async (dispatch: Dispatch) => {
try {
const faqsCalled = await axios.get("http://87.106.229.119//api/apps");
const faqsCalled = await axios.get("http://87.106.229.119/api/apps");
dispatch(setApps(faqsCalled.data));
} catch (error) {
console.log(error);
Expand All @@ -45,17 +45,17 @@ export const apiCallAppsInfo = async (
try {
dispatch(setLoadingApps(true));

const faqsCalled = await axios.get(`http://87.106.229.119//api/apps/${id}`, {
const faqsCalled = await axios.get(`http://87.106.229.119/api/apps/${id}`, {
headers: {
Authorization: `Bearer ${acces_token}`,
},
});
await dispatch(setAppsInfo(faqsCalled.data));
console.log(faqsCalled.data, `http://87.106.229.119//api/apps/${id}`);
console.log(faqsCalled.data, `http://87.106.229.119/api/apps/${id}`);

dispatch(setLoadingApps(false));
} catch (error) {
console.log(error, `http://87.106.229.119//api/apps/${id}`);
console.log(error, `http://87.106.229.119/api/apps/${id}`);
}
};
//Post //
Expand All @@ -65,7 +65,7 @@ export const postApiApps = async (
dispatch: Dispatch
) => {
try {
await axios.post("http://87.106.229.119//api/apps", appsContent, {
await axios.post("http://87.106.229.119/api/apps", appsContent, {
headers: {
Authorization: `Bearer ${acces_token}`,
},
Expand All @@ -83,7 +83,7 @@ export const deleteApiApps = async (
dispatch: Dispatch
) => {
try {
const url = `http://87.106.229.119//api/apps/${appsID}`;
const url = `http://87.106.229.119/api/apps/${appsID}`;
await axios.delete(url, {
headers: {
Authorization: `Bearer ${acces_token}`,
Expand All @@ -104,7 +104,7 @@ export const putApiApps = async (
id: number
) => {
try {
await axios.put("http://87.106.229.119//api/apps/" + id, faqContent, {
await axios.put("http://87.106.229.119/api/apps/" + id, faqContent, {
headers: {
Authorization: `Bearer ${acces_token}`,
},
Expand Down
8 changes: 4 additions & 4 deletions src/store/reducers/faqsCall/faqsReducer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export const { setFaqs } = apiSlice.actions;

export const apiCall =async(dispatch:Dispatch)=>{
try {
const faqsCalled = await axios.get('http://87.106.229.119//api/faqs');
const faqsCalled = await axios.get('http://87.106.229.119/api/faqs');
dispatch(setFaqs(faqsCalled.data.faqs))

} catch (error) {
Expand All @@ -40,7 +40,7 @@ export const { setFaqs } = apiSlice.actions;
title:faqContent.title,
description:faqContent.description
}
await axios.post('http://87.106.229.119//api/faqs',newFaq,{
await axios.post('http://87.106.229.119/api/faqs',newFaq,{
headers:{
Authorization:`Bearer ${acces_token}`
}
Expand All @@ -55,7 +55,7 @@ export const { setFaqs } = apiSlice.actions;

export const deleteApiFaqs = async (faqId:number, acces_token:string,dispatch:Dispatch) => {
try {
const url = `http://87.106.229.119//api/faqs/${faqId}`;
const url = `http://87.106.229.119/api/faqs/${faqId}`;
await axios.delete(url,{
headers:{
Authorization: `Bearer ${acces_token}`
Expand All @@ -74,7 +74,7 @@ export const { setFaqs } = apiSlice.actions;
//Put //
export const putApiFaqs =async(faqId:number, faqContent:any, acces_token:string, dispatch:any)=>{
try{
await axios.put(`http://87.106.229.119//api/faqs/${faqId}`,faqContent,{
await axios.put(`http://87.106.229.119/api/faqs/${faqId}`,faqContent,{
headers:{
Authorization:`Bearer ${acces_token}`
}
Expand Down

0 comments on commit d9125ef

Please sign in to comment.