Created
February 9, 2019 17:42
-
-
Save Eraden/4b27c3e6c09f7037ebcd919f87c95556 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import { DELETE_FILE_ENTITY, GET_FILE_ENTITIES, GET_FILE_ENTITY } from "./types"; // NO! | |
import * as types from "./types"; // YES | |
// NO! | |
export const getFile = filename => { | |
const res = await axios.get(`http://localhost:8080/api/files/${filename}`); | |
dispatch({ | |
type: GET_FILE_ENTITY, | |
payload: res.data | |
}); | |
}; | |
// YES | |
export const getFile = filename => { | |
const { data } = await axios.get(`http://localhost:8080/api/files/${filename}`); | |
dispatch({ | |
type: types.GET_FILE_ENTITY, | |
payload: data | |
}); | |
}; | |
// NO | |
if ( | |
window.confirm( | |
`You are deleting file_entity task ${file_entity_id}, this action cannot be undone` | |
) | |
) {} | |
// YES | |
const confirmDeleteFile = () => window.confirm(`You are deleting file_entity task ${file_entity_id}, this action cannot be undone`) | |
if (confirmDeleteFile()) {} | |
/// GOOOOOD! | |
export const GET_FILE_ENTITY = "GET_FILE_ENTITY"; | |
export const GET_FILE_ENTITIES = "GET_FILE_ENTITIES" | |
export const DELETE_FILE_ENTITY = "DELETE_FILE_ENTITY"; | |
export const GET_ERRORS = "GET_ERRORS"; | |
///// | |
// Consider i18next | |
// https://www.i18next.com/overview/getting-started | |
<th>File Name</th> | |
<th>Content Type:</th> | |
<th>Uploaded</th> | |
/// NOOOO! | |
https://github.com/Jaguarete1011/RiaFullApp/blob/dev/ria_app_client/src/components/Service/FileService.js |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment