<template>
	<view>
		<view class="list-row" @click="quitClick">
			<icon class="list-icon login-out-icon"></icon>
			<text>退出登录</text>
		</view>
	</view>
</template>

<script setup>
import {logout} from '@/api/login.js'
import cacheManager from '@/utils/cacheManager.js';
function quitClick(){
	uni.showModal({
	        title: '提示',
	        content: '你确定要执行这个操作吗？',
	        success: (res) => {
	          if (res.confirm) {
	            // 用户点击了确定按钮，执行你的操作
	            console.log('用户点击了确定');
	           quit()
	          } else if (res.cancel) {
	            // 用户点击了取消按钮
	            console.log('用户点击了取消');
	          }
	        }
	      });
	
	 }
function quit (){
		logout().then(res=>{
			console.log('logout')
			toast('退出登录成功')
			cacheManager.clearAll();
		}).catch(err => {
		toast('退出登录失败，请稍后重试')
	})
	
}
</script>

<style>
</style>