promise

PHOTO EMBED

Thu Oct 19 2023 07:53:06 GMT+0000 (Coordinated Universal Time)

Saved by @kiroy

getUser() {
      const vm = this;
      vm.$loadingStore.openLoading();

      return new Promise((resolve, reject) => {
        vm.$api.authApi.getUser().then((response) => {
          if (response.data.ErrorMessage) {
            this.$notify({
              message: response.data.ErrorMessage,
              type: "error",
            });

            reject("失敗");
          } else {
            resolve(response.data);
          }
          vm.$loadingStore.closeLoading();
        });
      });
    },
content_copyCOPY