common.js 410 B

12345678910111213
  1. import pagesJson from '@/pages.json'
  2. const uniIdCo = uniCloud.importObject("uni-id-co")
  3. export default {
  4. async logout() {
  5. await uniIdCo.logout()
  6. uni.removeStorageSync('uni_id_token');
  7. uni.setStorageSync('uni_id_token_expired', 0)
  8. uni.redirectTo({
  9. url: `/${pagesJson.uniIdRouter?.loginPage ?? 'uni_modules/uni-id-pages/pages/login/login-withoutpwd'}`,
  10. });
  11. uni.$emit('uni-id-pages-logout')
  12. },
  13. }