some shit..
This commit is contained in:
@@ -1,5 +1,7 @@
|
||||
import { defineStore } from "pinia";
|
||||
import { useEmployees } from "../employees";
|
||||
import { useUser } from "../user";
|
||||
import axios from '@/axios'
|
||||
import _clone from "lodash/clone";
|
||||
import _difference from "lodash/difference";
|
||||
import _pull from "lodash/pull";
|
||||
@@ -40,8 +42,21 @@ export const settingsEmployeesIndex = defineStore({
|
||||
* Persist columnsSelected to API
|
||||
*/
|
||||
async persist() {
|
||||
console.log("persist")
|
||||
console.log(this.columnsSelected)
|
||||
const user = useUser()
|
||||
|
||||
const result = await axios.post('settings',
|
||||
{
|
||||
settings: [
|
||||
{
|
||||
key: "employees-index-columns-selected",
|
||||
value: JSON.stringify(this.columnsSelected)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
headers: user.header
|
||||
})
|
||||
console.log(result)
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -3,7 +3,10 @@ import { useNotifications } from './notifications'
|
||||
import { getUnixTime } from 'date-fns'
|
||||
import { AxiosError } from 'axios'
|
||||
import axios from '@/axios'
|
||||
import { apiUrl } from '@/axios'
|
||||
import Axios from 'axios'
|
||||
import { useRequest } from 'vue-request'
|
||||
import { json } from 'stream/consumers'
|
||||
|
||||
type AuthSuccResult = {
|
||||
user: string,
|
||||
@@ -34,21 +37,18 @@ export const useUser = defineStore({
|
||||
|
||||
actions: {
|
||||
async login(username: string, password: string):
|
||||
Promise<
|
||||
boolean |
|
||||
Promise<boolean |
|
||||
'E_INVALID_AUTH_PASSWORD: Password mis-match' |
|
||||
'E_INVALID_AUTH_UID: User not found'
|
||||
> {
|
||||
'E_INVALID_AUTH_UID: User not found'>
|
||||
{
|
||||
|
||||
const notifications = useNotifications()
|
||||
|
||||
|
||||
try {
|
||||
const response = await axios.post<AuthSuccResult>('login', {
|
||||
username: username,
|
||||
password: password
|
||||
})
|
||||
|
||||
console.log(response)
|
||||
|
||||
this.isLoggedIn = true
|
||||
this.user = response.data.user
|
||||
@@ -76,7 +76,7 @@ export const useUser = defineStore({
|
||||
|
||||
notifications.add('danger', err as string, -1)
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user