<template>
	<a-row></a-row>
</template>

<script>
import { watch, onMounted, computed, ref, defineComponent } from "vue";
import { SyncOutlined, CloudDownloadOutlined } from "@ant-design/icons-vue";
import common from "../../common/composable/common";
import axios from "axios";

export default defineComponent({
	components: {
		SyncOutlined,
		CloudDownloadOutlined,
	},
	setup() {
		const { appSetting } = common();
		const appVersion = window.config.app_version;
		const productStatus = ref("fetching");
		const product = ref([]);

		onMounted(() => {
			if (appSetting.value.update_app_notification) {
				axiosAdmin("superadmin/update-app").then((response) => {
					axios
						.post("https://envato.codeifly.com/product", {
							verified_name: window.config.product_name,
							domain: "test",
						})
						.then((res) => {
							product.value = res.data;

							if (product.value.product.version != appVersion) {
								productStatus.value = "success";
							} else {
								productStatus.value = "success";
							}
						});
				});
			}
		});

		return {
			appSetting,
			productStatus,
			product,
		};
	},
});
</script>
