Updates
This commit is contained in:
Vendored
+9
@@ -0,0 +1,9 @@
|
||||
import { APILoginFunctionReturn } from "../../package-shared/types";
|
||||
/**
|
||||
* Client Setup After Login
|
||||
* ===============================================================================
|
||||
* @description This function sets local storage variables like `csrf` after a user
|
||||
* is logged in. Use this in conjunction with the `datasquirel.user.loginUser`
|
||||
* function
|
||||
*/
|
||||
export default function postLogin(res: APILoginFunctionReturn): boolean;
|
||||
Vendored
+24
@@ -0,0 +1,24 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
exports.default = postLogin;
|
||||
/**
|
||||
* Client Setup After Login
|
||||
* ===============================================================================
|
||||
* @description This function sets local storage variables like `csrf` after a user
|
||||
* is logged in. Use this in conjunction with the `datasquirel.user.loginUser`
|
||||
* function
|
||||
*/
|
||||
function postLogin(res) {
|
||||
try {
|
||||
if (!res.payload)
|
||||
return false;
|
||||
if (!res.payload.csrf_k)
|
||||
return false;
|
||||
localStorage.setItem("csrf", res.payload.csrf_k);
|
||||
localStorage.setItem("user", JSON.stringify(res.payload));
|
||||
return true;
|
||||
}
|
||||
catch (error) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user