fix timer(Tracker/ModalTicket) fix fileUpload
(Tracker/ModalTicket) fix tgToken(PartnerSettings)
This commit is contained in:
@ -490,18 +490,27 @@ export const ModalTiсket = ({
|
||||
}, [taskTags]);
|
||||
|
||||
async function handleUpload(event) {
|
||||
const formData = new FormData();
|
||||
formData.append("uploadFile", event.target.files[0]);
|
||||
const res = await fetch("https://itguild.info/api/file/upload", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
headers: { ...getToken() }
|
||||
});
|
||||
try {
|
||||
const formData = new FormData();
|
||||
formData.append("uploadFile", event.target.files[0]);
|
||||
|
||||
const data = await res.json();
|
||||
const res = await fetch("https://itguild.info/api/file/upload", {
|
||||
method: "POST",
|
||||
body: formData,
|
||||
headers: { ...getToken() }
|
||||
});
|
||||
|
||||
// setUploadedFile(data);
|
||||
attachFile(data[0].id);
|
||||
const data = await res.json();
|
||||
|
||||
// setUploadedFile(data);
|
||||
attachFile(data[0].id);
|
||||
} catch {
|
||||
showNotification({
|
||||
show: true,
|
||||
text: "Неверный формат файла",
|
||||
type: "error"
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
// function deleteLoadedFile() {
|
||||
@ -543,7 +552,7 @@ export const ModalTiсket = ({
|
||||
|
||||
function run() {
|
||||
updateTimerSec++;
|
||||
if (updateTimerSec > 60) {
|
||||
if (updateTimerSec > 59) {
|
||||
updateTimerMinute++;
|
||||
updateTimerSec = 0;
|
||||
}
|
||||
@ -561,7 +570,7 @@ export const ModalTiсket = ({
|
||||
|
||||
function correctTimerTime(time) {
|
||||
if (time < 10) return `0${time}`;
|
||||
if (time > 10) return time;
|
||||
if (time >= 10) return time;
|
||||
}
|
||||
|
||||
useEffect(() => {
|
||||
@ -800,7 +809,7 @@ export const ModalTiсket = ({
|
||||
name="file"
|
||||
id="input__file"
|
||||
type="file"
|
||||
accept="image/*,.png,.jpg,.svg,.jpeg"
|
||||
accept="image/*,.png,.jpg,.svg,.jpeg,.doc,.docx,.xls,.xlsx,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.ms-excel,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
|
||||
className="input__file"
|
||||
onChange={handleUpload}
|
||||
/>
|
||||
|
Reference in New Issue
Block a user