fix login
This commit is contained in:
parent
be7ed728a3
commit
39cdf1c162
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { ref, nextTick, watch, onMounted } from 'vue';
|
||||
import { useRoute, useRouter } from 'vue-router';
|
||||
import { getApiUrl } from './net';
|
||||
import { encodeUTF8ToBase64, getApiUrl } from './utils';
|
||||
|
||||
const router = useRouter();
|
||||
const route = useRoute();
|
||||
@ -35,7 +35,7 @@
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"X-Id": login.value,
|
||||
"X-Id": encodeUTF8ToBase64(login.value),
|
||||
"X-Password": password.value
|
||||
},
|
||||
}
|
||||
@ -65,7 +65,7 @@
|
||||
{
|
||||
method: "POST",
|
||||
headers: {
|
||||
"X-Id": login.value,
|
||||
"X-Id": encodeUTF8ToBase64(login.value),
|
||||
"X-Password": password.value
|
||||
},
|
||||
body: JSON.stringify({
|
||||
|
@ -1,7 +1,7 @@
|
||||
<script setup lang="ts">
|
||||
import { onMounted, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
import { getApiUrl } from './net';
|
||||
import { encodeUTF8ToBase64, getApiUrl } from './utils';
|
||||
|
||||
const router = useRouter();
|
||||
|
||||
@ -19,7 +19,7 @@
|
||||
{
|
||||
method: "GET",
|
||||
headers: {
|
||||
"X-Id": login.value,
|
||||
"X-Id": encodeUTF8ToBase64(login.value),
|
||||
"X-Password": password.value
|
||||
},
|
||||
}
|
||||
|
@ -1,5 +0,0 @@
|
||||
export function getApiUrl(path: string) {
|
||||
const url = "http://" + window.location.host.split(":")[0] + ":8090" + path
|
||||
console.log(url)
|
||||
return url
|
||||
}
|
9
src/components/utils.ts
Normal file
9
src/components/utils.ts
Normal file
@ -0,0 +1,9 @@
|
||||
export function getApiUrl(path: string) {
|
||||
const url = "http://" + window.location.host.split(":")[0] + ":8090" + path
|
||||
console.log(url)
|
||||
return url
|
||||
}
|
||||
|
||||
export function encodeUTF8ToBase64(s: string) {
|
||||
return btoa(encodeURIComponent(s).replace(/%([0-9A-F]{2})/g, (_, p1) => String.fromCharCode(parseInt(p1, 16))))
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user