/*
 * @Description: 
 * @Version: 
 * @Author: 孙子呷约
 * @Date: 2023-10-24 12:36:14
 */

import { envWx, EnvType } from '@/config';

type TokenKeyMap = Record<EnvType, string>;

const mapTokenKey: TokenKeyMap = {
    develop: 'token',
    trial: 'develop-token',
    release: 'App-Token',
};

const TokenKey: string = mapTokenKey[envWx];

export function getToken(): string {
    return uni.getStorageSync(TokenKey) || '';
}

export function setToken(token: string): void {
    uni.setStorageSync(TokenKey, token);
}

export function removeToken(): void {
    uni.removeStorageSync(TokenKey);
}

export function setStorageOrgId(orgId: string): void {
    uni.setStorageSync('orgId', orgId);
}
