1
Fork 0
mirror of https://github.com/pds-nest/nest.git synced 2025-03-13 20:14:53 +00:00

–🇮🇹 Small changes to translation

This commit is contained in:
@uni-chiara 2021-05-14 11:31:14 +02:00
parent ff8d6290b8
commit bbad3a3c87
9 changed files with 24 additions and 24 deletions

View file

@ -28,7 +28,7 @@ export default function GlobalUser({ children }) {
*/ */
const fetchDataAuth = useCallback(async (method, path, body, init) => { const fetchDataAuth = useCallback(async (method, path, body, init) => {
if(!user) { if(!user) {
throw new Error("Not logged in") throw new Error("Non effettuato l'accesso")
} }
if(!init) { if(!init) {
@ -50,13 +50,13 @@ export default function GlobalUser({ children }) {
* @returns {Promise<void>} * @returns {Promise<void>}
*/ */
const login = useCallback(async (email, password) => { const login = useCallback(async (email, password) => {
console.debug("Contacting server to login...") console.debug("Contattando il server per accedere...")
const data = await fetchData("POST", `/api/v1/login`, { const data = await fetchData("POST", `/api/v1/login`, {
"email": email, "email": email,
"password": password, "password": password,
}) })
console.debug("Storing login state...") console.debug("Memorizzando lo stato di login...")
setUser({ setUser({
email: data["user"]["email"], email: data["user"]["email"],
isAdmin: data["user"]["isAdmin"], isAdmin: data["user"]["isAdmin"],
@ -64,18 +64,18 @@ export default function GlobalUser({ children }) {
token: data["access_token"], token: data["access_token"],
}) })
console.info("Login successful!") console.info("Accesso effettuato!")
}, [fetchData, setUser]) }, [fetchData, setUser])
/** /**
* Logout from the currently active server. * Logout from the currently active server.
*/ */
const logout = useCallback(() => { const logout = useCallback(() => {
console.debug("Clearing login state...") console.debug("Ripulendo lo stato di login...")
setUser(null) setUser(null)
console.debug("Cleared login state!") console.debug("Stato di login ripulito!")
console.info("Logout successful!") console.info("Logout avvenuto con successo!")
}, [setUser]) }, [setUser])
return ( return (

View file

@ -71,10 +71,10 @@ export default function RepositoryEditor({
const save = useCallback( const save = useCallback(
async () => { async () => {
if(!id) { if(!id) {
console.info("Creating new repository with body: ", body) console.info("Creando una nuova repository avente come corpo: ", body)
} }
else { else {
console.info("Editing repository ", id, " with body: ", body) console.info("Modificando la repository ", id, " con corpo: ", body)
} }
await fetchNow() await fetchNow()
}, },
@ -104,7 +104,7 @@ export default function RepositoryEditor({
(newCond) => { (newCond) => {
// Check for content // Check for content
if(!newCond.content) { if(!newCond.content) {
console.debug("Refusing to add ", newCond, ": content is empty.") console.debug("Impossibile aggiungere ", newCond, ": l'oggetto è vuoto.")
return return
} }
@ -117,11 +117,11 @@ export default function RepositoryEditor({
} }
} }
if(duplicate) { if(duplicate) {
console.debug("Refusing to add ", newCond, ": ", duplicate, " already exists.") console.debug("Impossibile aggiungere ", newCond, ": ", duplicate, " è già esistente.")
return return
} }
console.debug("Adding ", newCond, " to the Repository Conditions") console.debug("Aggiungendo ", newCond, " alle condizioni del repository")
appendRawCondition(newCond) appendRawCondition(newCond)
}, },
[_conditions, appendRawCondition], [_conditions, appendRawCondition],

View file

@ -16,7 +16,7 @@ import { createContext } from "react"
*/ */
const ContextServer = createContext({ const ContextServer = createContext({
server: null, server: null,
setServer: () => console.error("Trying to setServer while outside a ContextServer.Provider!"), setServer: () => console.error("Provato ad eseguire setServer mentre fuori da un ContextServer.Provider!"),
fetchData: () => console.error("Trying to fetchData while outside a ContextServer.Provider!"), fetchData: () => console.error("Provato ad eseguire fetchData mentre fuori da un ContextServer.Provider!"),
}) })
export default ContextServer export default ContextServer

View file

@ -14,6 +14,6 @@ import { createContext } from "react"
const ContextTheme = createContext({ const ContextTheme = createContext({
isSet: false, isSet: false,
theme: "ThemeDark", theme: "ThemeDark",
setTheme: () => console.error("Trying to setTheme while outside a ContextTheme.Provider!"), setTheme: () => console.error("Provato a eseguire setTheme mentre fuori da un ContextTheme.Provider!"),
}) })
export default ContextTheme export default ContextTheme

View file

@ -19,8 +19,8 @@ import { createContext } from "react"
*/ */
const ContextUser = createContext({ const ContextUser = createContext({
user: null, user: null,
login: () => console.error("Trying to login while outside a ContextUser.Provider!"), login: () => console.error("Provato ad eseguire l'accesso mentre fuori da un ContextUser.Provider!"),
logout: () => console.error("Trying to logout while outside a ContextUser.Provider!"), logout: () => console.error("Provato ad eseguire il logout mentre fuori da un while outside a ContextUser.Provider!"),
fetchDataAuth: () => console.error("Trying to fetchDataAuth while outside a ContextUser.Provider!"), fetchDataAuth: () => console.error("Provato ad eseguire fetchDataAuth mentre fuori da un ContextUser.Provider!"),
}) })
export default ContextUser export default ContextUser

View file

@ -12,7 +12,7 @@ export default function useArrayState(def) {
const appendValue = useCallback( const appendValue = useCallback(
newSingle => { newSingle => {
console.debug("Appending ", newSingle, " to ArrayState") console.debug("Aggiungendo ", newSingle, " ad ArrayState")
setValue( setValue(
oldArray => [...oldArray, newSingle], oldArray => [...oldArray, newSingle],
) )
@ -22,7 +22,7 @@ export default function useArrayState(def) {
const spliceValue = useCallback( const spliceValue = useCallback(
position => { position => {
console.debug("Splicing ", position, " from ArrayState") console.debug("Estraendo ", position, " da ArrayState")
setValue( setValue(
oldArray => { oldArray => {
oldArray.splice(position, 1) oldArray.splice(position, 1)

View file

@ -8,7 +8,7 @@ import ContextRepositoryEditor from "../contexts/ContextRepositoryEditor"
export default function useRepositoryEditor() { export default function useRepositoryEditor() {
const context = useContext(ContextRepositoryEditor) const context = useContext(ContextRepositoryEditor)
if(!context) { if(!context) {
throw new Error("This component must be placed inside a RepositoryEditor.") throw new Error("Questo componente deve essere messo in un RepositoryEditor.")
} }
return context return context
} }

View file

@ -10,7 +10,7 @@
*/ */
export default function convertToLocalISODate(date) { export default function convertToLocalISODate(date) {
if(date.toString() === "Invalid Date") { if(date.toString() === "Invalid Date") {
throw new Error("Received an Invalid Date as parameter.") throw new Error("Data non valida ricevuta come parametro.")
} }
// Create a timezone naive ISO string // Create a timezone naive ISO string

View file

@ -10,13 +10,13 @@ export default function goToOnSuccess(func, history, destination) {
return (...args) => { return (...args) => {
let result let result
try { try {
console.debug("Trying to run: ", func) console.debug("Provando ad eseguire: ", func)
result = func(...args) result = func(...args)
history.push(destination) history.push(destination)
return result return result
} }
catch(e) { catch(e) {
console.debug("Failed to run ", func, ", not doing anything.") console.debug("Esecuzione fallita: ", func, ", non ha fatto nulla.")
throw e throw e
} }
} }