perf: 优化接口处理逻辑

This commit is contained in:
xiaoxian521
2026-01-12 09:22:26 +08:00
parent f2616fdfaf
commit 42076a2247
3 changed files with 30 additions and 24 deletions

View File

@@ -1,4 +1,5 @@
<script setup lang="ts">
import { message } from "@/utils/message";
import { initRouter } from "@/router/utils";
import { storageLocal } from "@pureadmin/utils";
import { type CSSProperties, ref, computed } from "vue";
@@ -32,12 +33,13 @@ const options = [
function onChange() {
useUserStoreHook()
.loginByUsername({ username: username.value, password: "admin123" })
.then(res => {
if (res.code === 0) {
storageLocal().removeItem("async-routes");
usePermissionStoreHook().clearAllCachePage();
initRouter();
}
.then(() => {
storageLocal().removeItem("async-routes");
usePermissionStoreHook().clearAllCachePage();
initRouter();
})
.catch(err => {
message(err, { type: "error" });
});
}
</script>