12345678910111213141516171819202122232425262728293031 |
- import { baseURL } from "./base.js";
- // console.log(window.localStorage.getItem("token"));
- let token;
- uni.getStorage({
- key: "token",
- success: function (res) {
- console.log(res);
- token = res.data;
- },
- });
- console.log(token);
- export const request = (option) => {
- return new Promise((resolve, reject) => {
- uni.request({
- url: baseURL + option.url,
- method: option.method,
- data: option.data,
- headers: {
- "content-type": "application/json",
- Authorization: "Bearer " + "token",
- },
- success: (res) => {
- resolve(res);
- },
- fail: (error) => {
- reject(error);
- },
- });
- });
- };
|