Skip to content
This repository has been archived by the owner on Dec 9, 2024. It is now read-only.

fix: preview TerminusName slice bug and update preview document title #3

Merged
merged 2 commits into from
May 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions packages/editor/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ node_modules
# Quasar core related directories
.quasar
/dist
.env
./build.sh
./releaseTest.sh

# Cordova related directories and files
/src-cordova/node_modules
Expand Down
1 change: 1 addition & 0 deletions packages/editor/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"qrcode.vue": "^3.4.1",
"quasar": "^2.6.0",
"vue": "^3.0.0",
"dotenv": "^16.4.5",
"vue-cropper": "^1.0.8",
"vue-draggable-next": "^2.1.1",
"vue-i18n": "^9.2.2",
Expand Down
15 changes: 9 additions & 6 deletions packages/editor/quasar.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@
// https://v2.quasar.dev/quasar-cli-vite/quasar-config-js

const { configure } = require('quasar/wrappers');
const dotenv = require('dotenv');

dotenv.config();
console.log(process.env);

module.exports = configure(function (/* ctx */) {
return {
Expand Down Expand Up @@ -65,10 +69,8 @@ module.exports = configure(function (/* ctx */) {
// analyze: true,
env: {
ACTION: process.env.ACTION,
NODE_RPC: 'https://sepolia.optimism.io',
CONTRACT_DID: '0x4c8c98e652d6a01494971a8faF5d3b68338f9ED4',
CONTRACT_ROOT_RESOLVER: '0xaA5bE49799b6A71Eda74d22D01F7A808aFf41b3f',
CONTRACT_REGISTRY: '0x9d100b3781cBB91746c13E876a3B520d22E0880F'
URL: process.env.URL,
WS_URL: process.env.WS_URL
}
// rawDefine: {}
// ignorePublicFolder: true,
Expand All @@ -86,12 +88,13 @@ module.exports = configure(function (/* ctx */) {

// Full list of options: https://v2.quasar.dev/quasar-cli-vite/quasar-config-js#devServer
devServer: {
// https: true
https: true,
host: process.env.DEV_DOMAIN || 'localhost',
port: 9100,
proxy: {
// proxy all requests starting with /api to the backend server
'/api': {
target: 'http://localhost:3020',
target: `https://profile.${process.env.ACCOUNT}.myterminus.com`,
changeOrigin: true,
pathRewrite: {
'^/api': ''
Expand Down
43 changes: 9 additions & 34 deletions packages/editor/src/App.vue
Original file line number Diff line number Diff line change
Expand Up @@ -2,70 +2,45 @@
<router-view />
</template>
<script>
//import { fetchData } from 'src/utils/helper';
//import { User } from 'src/types/User';
import { defineComponent, onMounted } from 'vue';
import { useUserStore } from 'stores/user';
//import { useProvide } from 'src/composables/useContext';
import axios from 'axios';

export default defineComponent({
name: 'App',
async preFetch() {
// if (process.env.ACTION === 'PREVIEW') {
// const response = await fetchData('/api/user');
// console.log(response);
// const userStore = useUserStore();
// try {
// userStore.setUser(response.data as User);
// } catch (e) {
// console.log(e);
// }
// }
const userStore = useUserStore();
if (process.env.ACTION === 'PREVIEW') {
return await axios
.get(window.location.origin + '/api/user/init')
.then((response) => {
console.log(response.data.data);

userStore.setUser(response.data.data.profile);
userStore.setInfo(response.data.data.info);

const profileName = userStore.user?.terminusName;
let title = '';
if (profileName) {
title = profileName;
} else {
title = userStore.info.terminusName;
}
document.title = title;
});
}
},
setup() {
//const { initUserData } = useProvide();
const userStore = useUserStore();

onMounted(async () => {
if (process.env.ACTION === 'EDITOR') {
axios
.get(window.location.origin + '/api/user/init')
.then((response) => {
userStore.setUser(response.data.data.profile);
userStore.setInfo(response.data.data.info);

const terminusName = response.data.data.info.terminusName;
const did = terminusName.slice(0, terminusName.indexOf('@'));
document.title = `${did} | Terminus HomePage`;

// initUserData(userStore.user);
userStore.getNftAddress();
});
}
// if (process.env.ACTION === 'EDITOR') {
// const userStore = useUserStore();
// try {
// const response = await fetchData('/api/user');
// console.log(response);
// initUserData(response.data as User);
// userStore.getNftAddress();
// } catch (e) {
// console.log(e);
// }
// }
// axios.get('/api/backend/v1/terminus-info');
});
}
});
Expand Down
Loading