user module + translations
This commit is contained in:
@@ -3,7 +3,7 @@ import { useAppStore } from '@/stores/app';
|
||||
export default {
|
||||
data(){
|
||||
return {
|
||||
store: null
|
||||
store: null,
|
||||
}
|
||||
},
|
||||
created(){
|
||||
@@ -32,5 +32,25 @@ export default {
|
||||
this.user = response.data.user;
|
||||
return this.user;
|
||||
},
|
||||
getErrorText(error){
|
||||
let msg = error?.response?.data?.error || error?.message;
|
||||
if (msg){
|
||||
if (typeof msg == 'object'){
|
||||
return JSON.stringify(msg);
|
||||
}else if (this.l.errors[msg]) {
|
||||
return this.l.errors[msg]
|
||||
}else {
|
||||
return msg;
|
||||
}
|
||||
}else{
|
||||
return error;
|
||||
}
|
||||
},
|
||||
toast(text, color, timeout=3000){
|
||||
this.store.snackbar.text = text;
|
||||
this.store.snackbar.color = color;
|
||||
this.store.snackbar.timeout = timeout;
|
||||
this.store.snackbar.show = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user