fix(map-converter): 修复 API 路径,调整文件扩展名处理逻辑,优化代码格式
This commit is contained in:
parent
1387a72a76
commit
2978c58b42
@ -1,4 +1,5 @@
|
|||||||
import axios from 'axios';
|
import axios from 'axios';
|
||||||
|
|
||||||
import { decodeTextFile } from './utils';
|
import { decodeTextFile } from './utils';
|
||||||
|
|
||||||
export type ProcessJsonListItem = {
|
export type ProcessJsonListItem = {
|
||||||
@ -65,7 +66,11 @@ export async function buildProcessJsonListPayload(
|
|||||||
const content = await decodeTextFile(file);
|
const content = await decodeTextFile(file);
|
||||||
if (!content) throw new Error(`楼层 ${floor.name} 的文件 ${file?.name} 读取为空`);
|
if (!content) throw new Error(`楼层 ${floor.name} 的文件 ${file?.name} 读取为空`);
|
||||||
placeholders.push(content);
|
placeholders.push(content);
|
||||||
const ext = String(file?.name || '').toLowerCase().split('.').pop() || '';
|
const ext =
|
||||||
|
String(file?.name || '')
|
||||||
|
.toLowerCase()
|
||||||
|
.split('.')
|
||||||
|
.pop() || '';
|
||||||
exts.push(ext);
|
exts.push(ext);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +114,7 @@ export async function buildProcessJsonListPayload(
|
|||||||
|
|
||||||
export async function postProcessJsonList(payload: ProcessJsonListItem[]): Promise<ProcessJsonListResult> {
|
export async function postProcessJsonList(payload: ProcessJsonListItem[]): Promise<ProcessJsonListResult> {
|
||||||
const client = axios.create();
|
const client = axios.create();
|
||||||
const url = '/api/map-converter/process-json-list';
|
const url = '/vwedApi/api/map-converter/process-json-list';
|
||||||
const response = await client.post(url, payload, { responseType: 'blob' });
|
const response = await client.post(url, payload, { responseType: 'blob' });
|
||||||
|
|
||||||
const contentType = (response.headers?.['content-type'] || '').toString().toLowerCase();
|
const contentType = (response.headers?.['content-type'] || '').toString().toLowerCase();
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user