generated from FGA0138-MDS-Ajax/template-repository
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from FGA0138-MDS-Ajax/CalendarAtt
fix: fix no render do react não chamando um getEventos a cada mudança…
- Loading branch information
Showing
2 changed files
with
66 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import server from "../config/axiosInstance"; | ||
import endpoints from "../constants/endpoints"; | ||
|
||
export const getActions = async () => { | ||
try { | ||
const action = await server.get(endpoints.action.base); | ||
return action; | ||
} catch (error) { | ||
console.log(error); | ||
throw error; | ||
} | ||
}; | ||
|
||
export const getSingleActions = async (actionId) => { | ||
try { | ||
const action = await server.get(endpoints.action.single(actionId)); | ||
return action; | ||
} catch (error) { | ||
console.log(error); | ||
throw error; | ||
} | ||
}; | ||
|
||
export const createAction = async (data) => { | ||
try { | ||
const action = await server.post(endpoints.action.base, data); | ||
return action; | ||
} catch (error) { | ||
console.log(error); | ||
throw error; | ||
} | ||
}; | ||
|
||
export const editAction = async (actionId, data) => { | ||
try { | ||
const action = await server.put(endpoints.action.single(actionId), data); | ||
return action; | ||
} catch (error) { | ||
console.log(error); | ||
throw error; | ||
} | ||
}; | ||
|
||
export const deleteAction = async (actionId) => { | ||
try { | ||
const action = await server.delete(endpoints.action.single(actionId)); | ||
return action; | ||
} catch (error) { | ||
console.log(error); | ||
throw error; | ||
} | ||
}; |