update sso

This commit is contained in:
2021-07-30 19:12:28 +05:30
parent 35ca021424
commit 4e3bc48ed0
9 changed files with 76 additions and 61 deletions

View File

@ -1,61 +1,76 @@
import React, {useState} from 'react';
import React, { useState } from 'react';
import axios from 'axios';
import {
CCol,
CFormGroup,
CInput,
CInputFile,
CLabel,
CButton,
CCard,
CCardHeader,
CCardBody,
CCardFooter,
} from '@coreui/react'
CCol,
CFormGroup,
CInput,
CInputFile,
CLabel,
CButton,
CCard,
CCardHeader,
CCardBody,
CCardFooter,
} from '@coreui/react'
import CIcon from '@coreui/icons-react'
function Uploader() {
const [file, setFile] = useState(null);
const [file, setFile] = useState(null);
function onChangeHandler(e){
setFile(e.target.files[0])
}
function onChangeHandler(e) {
setFile(e.target.files[0])
}
function onClickHandler(e) {
const data = new FormData()
data.append('file', file);
//console.log(file);
axios.post("http://natnats.mobilous.com:8000/upload", data, { // receive two parameter endpoint url ,form data
})
.then(res => { // then print response status
console.log(res.statusText)
});
}
function onClickHandler(e) {
const data = new FormData()
data.append('file', file);
//console.log(file);
axios.post("https://natnats.mobilous.com:8000/upload", data, { // receive two parameter endpoint url ,form data
})
.then(res => { // then print response status
console.log(res.statusText)
});
}
return (
<div>
<CCard>
<CCardHeader>
アップロード
</CCardHeader>
<CCardBody>
<CFormGroup row>
<CCol md="3">
<CLabel htmlFor="date-input">アップロードするファイルを選んでください</CLabel>
</CCol>
<CCol xs="12" md="9">
<CInputFile type="file" onChange={onChangeHandler} id="file-input" name="file-input"/>
</CCol>
</CFormGroup>
<CCardFooter>
<CButton type="submit" onClick={onClickHandler} size="sm" color="primary"><CIcon name="cil-scrubber" /> アップロード</CButton>
</CCardFooter>
</CCardBody>
</CCard>
</div>
)
return ( <
div >
<
CCard >
<
CCardHeader >
アップロード <
/CCardHeader> <
CCardBody >
<
CFormGroup row >
<
CCol md = "3" >
<
CLabel htmlFor = "date-input" > アップロードするファイルを選んでください < /CLabel> < /
CCol > <
CCol xs = "12"
md = "9" >
<
CInputFile type = "file"
onChange = { onChangeHandler }
id = "file-input"
name = "file-input" / >
<
/CCol> < /
CFormGroup > <
CCardFooter >
<
CButton type = "submit"
onClick = { onClickHandler }
size = "sm"
color = "primary" > < CIcon name = "cil-scrubber" / > アップロード < /CButton> < /
CCardFooter > <
/CCardBody> < /
CCard > <
/div>
)
}
export default Uploader
export default Uploader