简体   繁体   English

如何让每个用户的网站“独一无二”?

[英]How to make a site “unique” from each user?

I have made a "dating app" website where you can like hard-coded users - just an assignment not implemented in real life:).我制作了一个“约会应用程序”网站,您可以在其中喜欢硬编码的用户 - 只是一个在现实生活中没有实现的任务:)。 Whenever a user logs in - which it only can if it has SignUp - and likes a hard-coded match it gets saved via local storage.每当用户登录时——只有当它有注册时才能登录——并且喜欢硬编码的匹配,它会通过本地存储保存。 So whenever an other user logs in, that user has the exact same site and liked profiles.因此,每当其他用户登录时,该用户就拥有完全相同的网站和喜欢的个人资料。 So my question is, how do you save a user action individually on a website - in theory - so not everyone share the same site.所以我的问题是,你如何在网站上单独保存用户操作 - 理论上 - 所以不是每个人都共享同一个网站。 Links for articles would also be much appreciated, cause I investigated myself, but couldn't find any usefull articles.文章的链接也将不胜感激,因为我调查了自己,但找不到任何有用的文章。

Thank you for your help in advance!提前谢谢你的帮助!

I'm assuming you don't have a backend and that is why you are using local storage.我假设您没有后端,这就是您使用本地存储的原因。

logalstorage is a set of (key, value) pairs. logalstorage 是一组(键,值)对。 You'll need to make the key unique depending on the user that is logged in.您需要根据登录的用户使密钥唯一。

For example:例如:

  let user = "Greg"
  localStorage.setItem.(user + "likes", likes);

and to get the data later并稍后获取数据

  let likes = localStorage.getItem.(user + "likes");

This idea of a unique key is exactly how databases work.这种唯一键的想法正是数据库的工作方式。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何使每个唯一的时间戳更新 - How to make each unique timestamp update 如何为从数据库中获取的每个用户创建标记? - How can I make a marker for each user getting from the database? 如何知道用户来自站点A - How to know the user is from site A 如何使用Express和Mongoose发布和获取每个登录用户所独有的数据? - How to Post and Get Data Unique to Each Logged In User with Express and Mongoose? 如何确保多个输入均具有唯一值 - How to make sure multiple inputs each have a unique value 如何为每个唯一用户而不是 localStorage 实现持久化? - How to achieve persistence for each unique user instead of localStorage? 如何为购物网站的每种产品制作挑选图片幻灯片 - how to make pick & choose image slide for each products of a shopping site 如何重定向来自特定站点的用户 - How to redirect user coming from certain site 如何确保只有从特定功能重定向的用户才能访问我的网站页面? - How can I make sure that a user visits a page of my site only if he's redirected from a specific function? 如何使网站移动友好,一个选项是使每个网站的移动版本 - How to make the site mobile friendly ,one option is to make mobile version of each
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM