增加 js-base64 解决无法正常 decode 的问题
This commit is contained in:
parent
62c34ebc86
commit
9883ceffe6
@ -16,6 +16,7 @@
|
|||||||
"big.js": "^6.2.1",
|
"big.js": "^6.2.1",
|
||||||
"core-js": "^3.37.1",
|
"core-js": "^3.37.1",
|
||||||
"eslint-plugin-prettier": "^5.2.1",
|
"eslint-plugin-prettier": "^5.2.1",
|
||||||
|
"js-base64": "^3.7.7",
|
||||||
"pinia-plugin-persistedstate": "^3.2.1",
|
"pinia-plugin-persistedstate": "^3.2.1",
|
||||||
"roboto-fontface": "*",
|
"roboto-fontface": "*",
|
||||||
"vue": "^3.4.31",
|
"vue": "^3.4.31",
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
import { defineStore } from "pinia";
|
import { defineStore } from "pinia";
|
||||||
import axios from "axios";
|
import axios from "axios";
|
||||||
import config from "@/config/config";
|
import config from "@/config/config";
|
||||||
|
import { Base64 } from "js-base64";
|
||||||
|
|
||||||
let timer: any = null;
|
let timer: any = null;
|
||||||
|
|
||||||
@ -27,7 +28,8 @@ export const useUserStore = defineStore("user", {
|
|||||||
expiredAt: number,
|
expiredAt: number,
|
||||||
) {
|
) {
|
||||||
const idTokenParts = idToken.split(".");
|
const idTokenParts = idToken.split(".");
|
||||||
const idTokenPayload = JSON.parse(atob(idTokenParts[1]));
|
|
||||||
|
const idTokenPayload = JSON.parse(Base64.decode(idTokenParts[1]));
|
||||||
|
|
||||||
expiredAt = Date.now() + expiredAt * 1000;
|
expiredAt = Date.now() + expiredAt * 1000;
|
||||||
this.expired_at = expiredAt;
|
this.expired_at = expiredAt;
|
||||||
|
Loading…
Reference in New Issue
Block a user