@sunggang/ui-lib 0.2.78 → 0.2.79
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.esm2.js
CHANGED
|
@@ -58924,7 +58924,7 @@ var LiffProvider = function(param) {
|
|
|
58924
58924
|
// 登入初始化函數
|
|
58925
58925
|
var loginInit = function() {
|
|
58926
58926
|
var _ref = _async_to_generator(function(token) {
|
|
58927
|
-
var _resData_data, _resData_data1, response, resData, loginToken, err;
|
|
58927
|
+
var _resData_data, _resData_data1, _resData_data2, response, resData, loginToken, err;
|
|
58928
58928
|
return _ts_generator(this, function(_state) {
|
|
58929
58929
|
switch(_state.label){
|
|
58930
58930
|
case 0:
|
|
@@ -58955,16 +58955,19 @@ var LiffProvider = function(param) {
|
|
|
58955
58955
|
case 2:
|
|
58956
58956
|
response = _state.sent();
|
|
58957
58957
|
resData = response;
|
|
58958
|
+
console.log("login response", response);
|
|
58958
58959
|
setLoginData(resData);
|
|
58959
58960
|
if ((resData === null || resData === void 0 ? void 0 : (_resData_data = resData.data) === null || _resData_data === void 0 ? void 0 : _resData_data.access_token) && typeof resData.data.access_token === "string" && resData.data.access_token.trim() !== "" && !resData.data.access_token.startsWith("Bearer ")) {
|
|
58960
58961
|
resData.data.access_token = "Bearer ".concat(resData.data.access_token);
|
|
58961
58962
|
}
|
|
58963
|
+
console.log("has token", !!(resData === null || resData === void 0 ? void 0 : (_resData_data1 = resData.data) === null || _resData_data1 === void 0 ? void 0 : _resData_data1.access_token));
|
|
58962
58964
|
window.localStorage.setItem(localStorageKey, JSON.stringify(resData));
|
|
58963
|
-
loginToken = resData === null || resData === void 0 ? void 0 : (
|
|
58965
|
+
loginToken = resData === null || resData === void 0 ? void 0 : (_resData_data2 = resData.data) === null || _resData_data2 === void 0 ? void 0 : _resData_data2.access_token;
|
|
58964
58966
|
if (loginToken) {
|
|
58965
58967
|
setAccessToken(loginToken);
|
|
58966
58968
|
if (memberInfoUrl) fetchMemberInfo(loginToken);
|
|
58967
58969
|
} else {
|
|
58970
|
+
console.log(response);
|
|
58968
58971
|
setUserInfo(response);
|
|
58969
58972
|
if (handleLoginError) handleLoginError();
|
|
58970
58973
|
}
|
|
@@ -59073,6 +59076,9 @@ var LiffProvider = function(param) {
|
|
|
59073
59076
|
6
|
|
59074
59077
|
];
|
|
59075
59078
|
case 6:
|
|
59079
|
+
if (isFriendship && isValid) return [
|
|
59080
|
+
2
|
|
59081
|
+
];
|
|
59076
59082
|
if (!lineToken) return [
|
|
59077
59083
|
3,
|
|
59078
59084
|
8
|
package/package.json
CHANGED
|
@@ -6,6 +6,7 @@ type LiffContextType = {
|
|
|
6
6
|
accessToken: string;
|
|
7
7
|
liffError: string | null;
|
|
8
8
|
initializeLiff: () => Promise<void>;
|
|
9
|
+
isFriendship: boolean | null;
|
|
9
10
|
};
|
|
10
11
|
export declare const LiffContext: React.Context<LiffContextType | undefined>;
|
|
11
12
|
export declare const LiffProvider: ({ children, liffId, localStorageKey, checkTokenUrl, loginUrl, memberInfoUrl, openInApp, ignoreCheckAddFriend, ignoreRoute, loginByUser, customerRedirectUrl, inviteCode, handleLoginError, }: {
|