Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Atualizando codigo vue #63

Merged
merged 1 commit into from
Feb 11, 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
68 changes: 30 additions & 38 deletions src/views/Popup/Popup.vue
Original file line number Diff line number Diff line change
Expand Up @@ -78,54 +78,46 @@
</div>
</div>
</template>
<script>
<script setup>
import { onMounted, ref } from "vue";
import { NextStorage } from "../../services/NextStorage";
import { setupStorageESM } from "../../utils/setupStorageESM";

setupStorageESM();

export default {
name: "App",
const students = ref(null);
const loading = ref(false);
const error = ref(null);

data() {
return {
students: null,
loading: false,
error: false,
};
},
onMounted(() => {
loading.value = true;
const DELAY = 2_000;
setTimeout(() => useUsersStorage(), DELAY);
});

created() {
this.loading = true;
setTimeout(() => this.fetch(), 2000);
},
const useUsersStorage = async () => {
loading.value = true;
error.value = false;

methods: {
async fetch() {
this.loading = true;
this.error = false;

try {
this.students = await NextStorage.getItem("ufabc-extension-students");
this.error = false;
} catch (err) {
this.error = true;
}
this.loading = false;
},
try {
students.value = await NextStorage.getItem("ufabc-extension-students");
error.value = false;
} catch (err) {
error.value = true;
}
loading.value = false;
};

formatDate(date) {
if (!date) return;
const formatDate = (date) => {
if (!date) return;

let d = new Date(date);
const day = (d.getDate() < 10 ? "0" : "") + d.getDate();
const month = (d.getMonth() < 10 ? "0" : "") + (d.getMonth() + 1);
const year = d.getFullYear();
const hour = (d.getHours() < 10 ? "0" : "") + d.getHours();
const minutes = (d.getMinutes() < 10 ? "0" : "") + d.getMinutes();
return day + "/" + month + "/" + year + " " + hour + ":" + minutes;
},
},
let d = new Date(date);
const day = (d.getDate() < 10 ? "0" : "") + d.getDate();
const month = (d.getMonth() < 10 ? "0" : "") + (d.getMonth() + 1);
const year = d.getFullYear();
const hour = (d.getHours() < 10 ? "0" : "") + d.getHours();
const minutes = (d.getMinutes() < 10 ? "0" : "") + d.getMinutes();
return `${day}/${month}/${year} ${hour}:${minutes}`;
};
</script>
<style scoped>
Expand Down
19 changes: 0 additions & 19 deletions src/views/Popup/main.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,3 @@
import $ from "jquery";
import _ from "lodash";

// chrome.storage.local.get(function (items) {
// var users = [];
// var exists = false;
// if (items) {
// for (var key in items) {
// if (_.get(items[key], '[0].cp', null) != null) {
// exists = true;
// users.push(key);
// };
// }
// if (exists) {
// $( 'p' ).replaceWith( 'Cadastrado para:' + users);
// }
// }
// })

import Vue from "vue";
import Vuetify from "vuetify";
import "../../styles/main.css";
Expand Down