|
@@ -17,7 +17,7 @@
|
|
|
<script lang="ts" setup>
|
|
|
import Api from '../static/http/api'
|
|
|
import { postRequest } from '../static/http'
|
|
|
-import { getOauthUrl, createWindow, callBackUrl, getCookie, removeCookie } from '../static/utils'
|
|
|
+import { getOauthUrl, createWindow, callBackUrl } from '../static/utils'
|
|
|
import { getStorage, removeStorage, setStorage, storageKey } from '../static/utils/storage'
|
|
|
import { ref } from 'vue'
|
|
|
import { ElMessage } from 'element-plus'
|
|
@@ -89,8 +89,6 @@ const twitterAuth = () => {
|
|
|
if ( code === 0 ) {
|
|
|
let url = getOauthUrl(data.authToken);
|
|
|
let win = createWindow(url);
|
|
|
- // timer
|
|
|
- clearInterval(timer.value);
|
|
|
timer.value = setInterval(() => {
|
|
|
if (win && win.closed) {
|
|
|
clearInterval(timer.value);
|
|
@@ -107,7 +105,7 @@ const twitterAuth = () => {
|
|
|
}
|
|
|
|
|
|
const twitterLogin = (data: { authToken: string, consumerKey: string }) => {
|
|
|
- let verifier = JSON.parse(getCookie(storageKey.verifier));
|
|
|
+ let verifier = getStorage(storageKey.verifier)
|
|
|
if (verifier) {
|
|
|
postRequest(Api.twitterLogin, {
|
|
|
params: {
|
|
@@ -119,7 +117,7 @@ const twitterLogin = (data: { authToken: string, consumerKey: string }) => {
|
|
|
let { code, data, msg } = res;
|
|
|
if ( code === 0 ) {
|
|
|
setStorage(storageKey.userInfo, data);
|
|
|
- removeCookie(storageKey.verifier);
|
|
|
+ removeStorage(storageKey.verifier);
|
|
|
location.href = `/nft/list`
|
|
|
} else {
|
|
|
ElMessage({
|