|
|
@ -672,7 +672,9 @@ export class PostForm extends Component<PostFormProps, PostFormState> { |
|
|
|
file = event; |
|
|
|
} |
|
|
|
|
|
|
|
const imageUploadUrl = isProduction ? `/pictrs/image` : `http://localhost:8536/pictrs/image`; |
|
|
|
const imageUploadUrl = isProduction |
|
|
|
? `/pictrs/image` |
|
|
|
: `http://localhost:8536/pictrs/image`; |
|
|
|
const formData = new FormData(); |
|
|
|
formData.append('images[]', file); |
|
|
|
|
|
|
@ -690,9 +692,13 @@ export class PostForm extends Component<PostFormProps, PostFormState> { |
|
|
|
console.log(res); |
|
|
|
if (res.msg == 'ok') { |
|
|
|
let hash = res.files[0].file; |
|
|
|
let url = isProduction ? `${window.location.origin}/pictrs/image/${hash}` : `http://localhost:8536/pictrs/image/${hash}`; |
|
|
|
let url = isProduction |
|
|
|
? `${window.location.origin}/pictrs/image/${hash}` |
|
|
|
: `http://localhost:8536/pictrs/image/${hash}`; |
|
|
|
let deleteToken = res.files[0].delete_token; |
|
|
|
let deleteUrl = isProduction ? `${window.location.origin}/pictrs/image/delete/${deleteToken}/${hash}` : `http://localhost:8536/pictrs/image/delete/${deleteToken}/${hash}`; |
|
|
|
let deleteUrl = isProduction |
|
|
|
? `${window.location.origin}/pictrs/image/delete/${deleteToken}/${hash}` |
|
|
|
: `http://localhost:8536/pictrs/image/delete/${deleteToken}/${hash}`; |
|
|
|
i.state.postForm.url = url; |
|
|
|
i.state.imageLoading = false; |
|
|
|
i.setState(i.state); |
|
|
|