Merge pull request 'Update' (#104) from that-fe into master
Reviewed-on: #104
This commit is contained in:
commit
5165ded25e
|
|
@ -55,8 +55,6 @@
|
|||
display: flex;
|
||||
margin-top: 20px;
|
||||
gap: 10px;
|
||||
max-height: 72vh;
|
||||
overflow-y: scroll;
|
||||
}
|
||||
|
||||
.titleSidebar {
|
||||
|
|
|
|||
|
|
@ -103,6 +103,9 @@ const StaffEvaluation = () => {
|
|||
name: '',
|
||||
role: '',
|
||||
note: '',
|
||||
user_id: 0,
|
||||
created_at: '',
|
||||
updated_at: '',
|
||||
},
|
||||
validate: {
|
||||
name: (value) =>
|
||||
|
|
@ -511,9 +514,10 @@ const StaffEvaluation = () => {
|
|||
|
||||
const handleCreate = async (values: DataProjectReview) => {
|
||||
try {
|
||||
const { id, ...data } = values
|
||||
const res = await post(projectReviewAdd, {
|
||||
...data,
|
||||
name: values.name,
|
||||
role: values.role,
|
||||
note: values.note,
|
||||
user_id: filter.userID,
|
||||
})
|
||||
if (res.id) {
|
||||
|
|
@ -530,7 +534,10 @@ const StaffEvaluation = () => {
|
|||
const handleUpdate = async (values: DataProjectReview) => {
|
||||
try {
|
||||
const res = await update(projectReviewUpdate, {
|
||||
...values,
|
||||
id: values.id,
|
||||
name: values.name,
|
||||
role: values.role,
|
||||
note: values.note,
|
||||
user_id: filter.userID,
|
||||
})
|
||||
if (res) {
|
||||
|
|
|
|||
|
|
@ -3,7 +3,6 @@ import { getFormDataHeader, getHeaderInfo } from '@/rtk/helpers/tokenCreator'
|
|||
import { removeTokens } from '@/rtk/localStorage'
|
||||
import { notifications } from '@mantine/notifications'
|
||||
import axios from 'axios'
|
||||
import moment from 'moment'
|
||||
const handleResponse = (response: any) => {
|
||||
if (response.status === 401) {
|
||||
removeTokens()
|
||||
|
|
@ -158,14 +157,18 @@ export const postImage = async (url: string, body: any, method: any) => {
|
|||
}
|
||||
}
|
||||
|
||||
export const exportFile = async (url: string, params: any = {}, fileName: string) => {
|
||||
export const exportFile = async (
|
||||
url: string,
|
||||
params: any = {},
|
||||
fileName: string,
|
||||
) => {
|
||||
const header = await getHeaderInfo()
|
||||
|
||||
|
||||
try {
|
||||
const response = await axios.get(url, {
|
||||
...header,
|
||||
params,
|
||||
responseType: 'blob'
|
||||
responseType: 'blob',
|
||||
})
|
||||
|
||||
if (response.status === 200) {
|
||||
|
|
@ -174,7 +177,7 @@ export const exportFile = async (url: string, params: any = {}, fileName: string
|
|||
const link = document.createElement('a')
|
||||
link.href = downloadUrl
|
||||
link.download = fileName
|
||||
|
||||
|
||||
document.body.appendChild(link)
|
||||
link.click()
|
||||
window.URL.revokeObjectURL(downloadUrl)
|
||||
|
|
@ -188,7 +191,7 @@ export const exportFile = async (url: string, params: any = {}, fileName: string
|
|||
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
throw new Error('Export failed')
|
||||
} catch (error: any) {
|
||||
notifications.show({
|
||||
|
|
|
|||
Loading…
Reference in New Issue