import {
	createSSRApp
} from "vue";
import App from "./App.vue";
import httpService from "./utils/http.js";
import api from "./utils/api.js";

export function createApp() {
	const app = createSSRApp(App);
	
	// 注册全局HTTP服务
	app.config.globalProperties.$http = httpService;
	app.config.globalProperties.$api = api;
	
	return {
		app,
	};
}

// #ifndef MP
// 处理 wx.connectSocket promisify 兼容问题，强制返回 SocketTask
uni.connectSocket = (function(connectSocket) {
	return function(options) {
		options.success = options.success || function() {}
		return connectSocket.call(this, options)
	}
})(uni.connectSocket)
// #endif
